On CentOS 6, run the following in the terminal as root.
cat <<'END_OF_TEXT' >> /etc/sysctl.conf net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 END_OF_TEXT sysctl -p service network restart
On CentOS 6, run the following in the terminal as root.
cat << 'END_OF_TEXT' >> /etc/sysctl.conf net.ipv4.tcp_timestamps = 0 END_OF_TEXT sysctl -p service network restart
To add a static route to CentOS 6
route add -net 10.2.0.0 netmask 255.255.0.0 gw 10.1.1.0
To delete a static route in CentOS 6
route delete -net 10.2.0.0
To make the changes permanent, edit the following file (replace 'interface' with the interface name - e.g. eth0)
/etc/sysconfig/network-scripts/route-interface
Define a static route. Each line is parsed as an individual route:
X.X.X.X/X via X.X.X.X dev interface
X.X.X.X/X is the network number and netmask for the static route. X.X.X.X and interface are the IP address and interface for the default gateway respectively. The X.X.X.X address does not have to be the default gateway IP address. In most cases, X.X.X.X will be an IP address in a different subnet, and interface will be the interface that is connected to, or can reach, that subnet. Add as many static routes as required.
The following is a sample route-eth0 file using the IP command arguments format. The default gateway is 192.168.0.1, interface eth0. The two static routes are for the 10.10.10.0/24 and 172.16.1.0/24 networks:
default 192.168.0.1 dev eth0 10.10.10.0/24 via 192.168.0.1 dev eth0 172.16.1.0/24 via 192.168.0.1 dev eth0
ip neighbor add 172.16.1.11 lladdr 00:50:56:AA:7D:E7 dev eth0 nud permanent
To start listening on a port and direct all data recieved into a text file, run the following. Remember, to listen on any port lower than 1025, you will need to run as root. The
nc
command is the netcat tool.
In this example, we listen on port 10000 and put the output to the file network.log
nc -l localhost 10000 > network.log
Get user account listening on port.
PORT=445
ps aux | grep `netstat -tulpna | grep LISTEN | awk -v port="$PORT" '{if ($4 ~ port) print $0;}' | awk '{print $7}' | cut -d'/' -f1` | grep -v grep | cut -d' ' -f1
Get user account that has a connection with a foreign port.
PORT=445
ps aux | grep `netstat -tulpna | grep ESTABLISHED | awk -v port="$PORT" '{if ($5 ~ port) print $0;}' | awk '{print $7}' | cut -d'/' -f1` | grep -v grep | cut -d' ' -f1
=Take over IP on Subnet= To send out a broadcast to the subnet announcing that your MAC address is to be associated with an IP address, use the following assuming that * The interface
eth1
is plugged into the subnet you want to work on. *
192.168.1.2
is the IP address you want to assume *
192.168.1.0
is the broadcast address for the subnet you are on
arping -c 1 -I eth1 -s 192.168.1.71 192.168.1.0