0

This question already has an answer here:

I am trying to configure ip address of network interfaces through terminal in ubuntu systems. So far successfully changed the IP address and other things through editing the interface file in the directory /etc/network/interfaces.

Is there any possibilities in changing the ip address of the interface through terminal using commands like configuring ip address of the router.

Thanks,Mohan

marked as duplicate by user88036, sebasth, RalfFriedl, Thomas, JigglyNaga Oct 5 '18 at 9:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

If you want to add a static ip using the cli without go to edit the interfaces files, you can use nmcli tool:

# nmcli con add type ethernet con-name static2 ifname eth0 ip4 192.168.1.5/24 gw4 192.168.1.1

in the event that you want to add a temporary static ip address you can use ifconfig:

# ifconfig eth0 192.168.1.5 netmask 255.255.255.0 broadcast 192.168.1.255

Not the answer you're looking for? Browse other questions tagged or ask your own question.