Configure Static IP Address on Linux

It is possible to configure a Linux network interface in multiple ways.

This is the one that might be simpler for beginners.

sudo ifconfig eth0 192.168.1.10 netmask 255.255.255.0;
sudo route add default gw 192.168.1.1 eth0;

ifconfig is an application that allows to configure a network interface.

In the above example sudo is the command that allows us to elevate the user privileges to configure the network interface.

eth0 is the available interface, the list of available interfaces can be listed using the command ifconfig.

192.168.1.10 is an example of a IP address it can be what you require to configure your network.

netmask identifies the subnet mask for the network that you are configuring. If you not sure what should be check the configuration settings of your router.

the second configuration line is the configuration of the default gateway. To achieve efficiency in getting out of the local network it is required to provide that information to the computer.

The gateway setting is the exit point of the local network to other networks. Route add is the command that it is used to add the route.

Default identifies that this is a default route. If no other route is inserted in the routing table the computer will use this route to speak with the remaining networks.

The address 192.168.1.1 is the ip address of the gateway normally the address of the router in a local network.

The eth0 is the local interface that will be used to reach the gateway.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.