Network settings for Linux at the shell prompt (terminal).
These are the manual settings for networking a Linux machine.
You should also have installed and setup the network card in the Linux machine as eth0 or eth1 (see Linux Ethernet-HOWTO if you don't know how to do it). Most Linux distributions do this automatically when you install Linux.
Before you start you can see how Linux automatically configured your network card by typing ifconfig, as shown in this example.
To do it at the shell prompt you need to create or edit a series of files as follows:
LINUX-NAME ... name of your machine without domain, e.g. PCLinux.
192.168.0.1 gateway ... the name of the default gateway machine
192.168.0.x LINUX-NAME ... the IP and name of the Linux machine
............. xxxxxxxxxx ... IP and name of all machines with fixed IP in LAN
nameserver 192.168.0.x ... the DNS server machine
- /etc/network/interfaces ... define the network configuration
auto lo ....start automatically the loopback interface
iface lo inet loopback ....define the i(nter)face lo inet (IPv4) loopback
iface eth1 inet dhcp ....define the i(nter)face eth1 inet (IPv4) static (or dhcp)
address 192.168.0.x .... the machine IP address
gateway 192.168.0.1 .... the gateway IP address
netmask 255.255.255.0 .... the netmask
network 192.168.0.0 .... the network IP address
broadcast 192.168.0.255 .... the broadcast IP address
auto eth1 ........start automatically the eth1 interface
- How to stop, start, restart an interface: ifdown and ifup: a Wiki about it.
NOTE: Of course do not include the comments starting with ...
This page is maintained by Al Bento
who can be reached at email@example.com. This page was last updated on October 1, 2012. Although we will attempt to keep this information accurate, we can not guarantee the accuracy of the information provided.