Assume you do not have curl/telnet/netcat (or nc does not support -z as in later versions ?? why did they remove it ?? ) the following will work on any recent Bash version. (echo > /dev/tcp/skinner/22) >/dev/null 2>&1 && echo “Port is open” || echo “Port is closed” nJoy 😉
Tag: network
Rate Limiting in iptables
iptables -A INPUT -p tcp –syn –dport 80 -m connlimit –connlimit-above 15 –connlimit-mask 32 -j REJECT –reject-with tcp-reset
Setting a route for a nic in Linux
In file named after the interface you want to use as gateway: e.g. /etc/sysconfig/network-scripts/route-eth0 Create entries : ADDRESS=192.168.4.0 NETMASK=255.255.255.0 GATEWAY=192.168.1.250 NnJoy 🙂
Windows setting a static route from commandline
Just a note to myself really ! route add -p 192.168.4.0 mask 255.255.255.0 192.168.1.250 metric 2
Move files with progress and bandwith limit
rsync –progress -ah –remove-sent-files –bwlimit=1000 source/ /target nJoy 🙂
Limiting access iptables
This is a Script that I use to deploy and script iptables. Sample handles ssh and mysql it’s easy to extend. #!/bin/bash # # iptables example configuration script # # Flush all current rules from iptables # iptables -F # # Allow SSH connections on tcp port 22 # This is essential when working on…
Moving a machine from one VM or physical box to another
This is the simple case where all we have is one disk that needs cloning. Assumptions for the following example Tools including backtrack distro available and permissible by company policy ( some c**ts get all agitated when sysadmins use a ‘knife’ to cut the ‘bread’ so be warned) Networking in place for the transfer preferable…
Script to list all the MAC addresses on the system
Listing the mac addresses of nic cards excluding null or loopback MACs i.e. 00:00:00:00:00:00 grep -H . /sys/class/net/*/address | awk ‘{split($0,array,”address:”);print array[2]}’ | grep -v ’00:00:00:00:00:00′
Wireshark: cutting the crap
DisplayFilters Wireshark uses display filters for general packet filtering while viewing and for its ColoringRules. The basics and the syntax of the display filters are described in the User’s Guide. The master list of display filter protocol fields can be found in the display filter reference. If you need a display filter for a specific protocol, have a look for…
Disable IPv6 in centOS
Edit /etc/sysconfig/network and set “NETWORKING_IPV6” to “no” For 5.4 and later, replace in /etc/modprobe.conf alias ipv6 off by options ipv6 disable=1 Alternative (which might be easier and works on any release with /etc/modprobe.d): # touch /etc/modprobe.d/disable-ipv6.conf # echo "install ipv6 /bin/true" >> /etc/modprobe.d/disable-ipv6.conf For CentOS 5.3 or older, add the following to /etc/modprobe.conf :…