Monday, 16 June 2014

Using the IP command

The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. ifconfig won't go away quickly, but its newer version, ip, is more powerful and will eventually replace it.
So here are the basics of the new ip command.

Assign a IP Address to Specific Interface:
sudo ip addr add 192.168.50.5 dev eth1 
Check an IP Address:
sudo ip addr show 
Remove an IP Address:
sudo ip addr del 192.168.50.5/24 dev eth1 
Enable Network Interface:
sudo ip link set eth1 up 
Disable Network Interface:
sudo ip link set eth1 down 
 Check Route Table:
sudo ip route show 
Add Static Route:
sudo ip route add 10.10.20.0/24 via 192.168.50.100 dev eth0 
Remove Static Route:
sudo ip route del 10.10.20.0/24 
Add Default Gateway:
sudo ip route add default via 192.168.50.100

Possibly Related Posts

No comments:

Post a Comment