How to add ip's to an interface in Linux

Find out what you interface is labeled using either the ifconfig or "ip a" command.  

Example using ifconfig: 

enp3s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet  netmask  broadcast
        ether 5c:b9:01:79:7e:18  txqueuelen 1000  (Ethernet)
        RX packets 272893777  bytes 85125059397 (79.2 GiB)
        RX errors 411  dropped 20  overruns 0  frame 0
        TX packets 163007862  bytes 85194460331 (79.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Example using "ip a":

root@194:~# ip a | more 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet scope host lo valid_lft forever preferred_lft forever 2: eno1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether 34:17:eb:e7:d4:ee brd ff:ff:ff:ff:ff:ff 3: enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 5c:b9:01:79:7e:18 brd ff:ff:ff:ff:ff:ff inet brd scope global enp3s0f0 valid_lft forever preferred_lft forever

You can see the interface is labeled "enp3s0f0".

So to bind an ip to this interface, you simply need to do:

ip a a dev enp3s0f0

To make the ip binding persistent across reboots, make sure to add that to /etc/rc.local so it would look like this:

ip a a dev enp3s0f0

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

ICMP Doesn't Work! got your new proxy blocks/ranges and you try to ping them from either the outside world...

Powered by WHMCompleteSolution