How to set a static IP Address from CLI

Assuming you want to make the following changes to the network device eth0

Change the IP to the static value 192.168.1.2
Set the Subnet Mask to 255.255.255.0
Set the Default Gateway for the device to be 192.168.1.1
you can perform these changes using the following two commands

#sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0;
#sudo route add default gw 192.168.1.1 eth0;

https://bytefreaks.net/gnulinux/how-to-set-a-static-ip-address-from-the-command-line-in-gnulinux-using-ifconfig-and-route

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s