Menu Close

Setting an IP address using the ip linux command

1) First, we'll check our current status and linux names of interfaces

ip a


ip link

where commands lists our' machine network interfaces, for example:


2) Next, using the subcommand addr we will add an IP address with a proper nework mask length

ip addr add dev [INTERFACE_NAME]

for example:

ip addr add dev eth1


3) No we will add default gateway's IP address  for correct routing

ip route add default via [GATEWAY_ADDRESS]

in our case for example:

ip route add default via

4) and finally start up the interface 

ip link set [INTERFACE_NAME] up

for example for eth1 interface:

ip link set eth1 up

5) And at last, check of corectness:

ip a


Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.