This is a simple bash script that is run by crontab every 5 minutes on a linux box. It e-mails me the new address when a change of IP address is detected. The script (ipchangemail.sh) #!/bin/bash # Check if IP-address has changed. If a change has occured, mail me the new address # Add the [...]
Posts Tagged: ifconfig
Create virtual / alias IP address
This is the code to make an alias IP address on network interface ethX where X is a number to indicate the device we are attaching the IP. ifconfig eth0:1 192.168.0.30 netmask 255.255.255.0 up Your machine will now answer on ping requests 192.168.0.30. You can see the result by running the command ifconfig eth0:1 Result [...]
Get your IP address
ifconfig eth0 | awk ‘/inet addr/{print $2}’ | cut -d: -f2
Recent Comments