The configuration of all network cards is basically /etc/network/interfaces in this file. If your IP address is obtained through DHCP , the default interfaces file should look like this:
wherein, the deviceLois aTCP/IPdefined byLoopbackvirtual network devices that enableTCP/IPTo be able to127.0.0.1thisIPAddress (the host name is typicallylocalhost) to access itself. eth0is the first NIC, if you have more than one network card, will beeth1,eth2and so on.
in the above configurationAutokeywords, so that the network device will start automatically when the system starts;Ifaceis aInterfacethe abbreviation, meaning"Interface"equipment. andDHCPThis means that the network device is going throughDHCPto getIPconfiguration information. If you want to specify manuallyIPaddress and other information, you will have toDHCPkeyword insteadStatic:
Auto Eth0iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1
among them, Address keyword designation IP address, netmask Specify the subnet mask, Gateway Specifies the gateway.
After the file is configured, you need to restart the network for it to take effect:
$ sudo/etc/init.d/networking Restart
if you want to control a network card separately, you can use the Ifdown/ifup command:
$sudo Ifdown Eth0$sudo ifup eth0
Ubuntu Server Network configuration file/etc/network/interfaces