Pages

Wednesday, September 24, 2014



Network Interfaces And The "ip" Command 

With the release of RHEL 7 the long threatened removal of the ifconfig has finally come about.
Ran into my first RHEL7 (Centos7 actually) box today while patching some VMs and had to work out the dreaded ip command.

In  a nutshell
Assuming you have a machine that needs it's network configured nad it does not have any configured interface  and you want to use the following details:
ip 10.10.10.23
gateway 10.10.10.1
netmask 255.255.255.0
network device: ens32

You can probably do it with these commands:

ip addr add 10.10.10.23/255.255.255.0 dev ens32
ip route add default via 10.10.10.1 dev ens32

View addresses with:
ip addr show

and routes with 
ip route show

completely unsurprisingly deleting is...
ip addr del 10.10.10.23/255.255.255.0 dev ens32
ip route del default via 10.10.10.1 dev ens32

Anything cleverer is left as an exercise for the reader, because at this point in time I probably have NFI.

Hope it helps.
If not ask me a question. I might be able to answer it.