Ubuntu network configuration by modifying the configuration file

Ubuntu network configuration system sometimes does not work with a graphical interface, in which case you can modify some startup scripts or configuration files directly

Ubuntu system network configuration involves several configuration files

1./etc/network/interfaces 2./etc/resolv.conf

Manipulating the steps of:

1. Open the ubuntu / etc / network / interfaces file default as follows:

the car

iface lo inet loopback

To configure a dynamic acquisition:

auto eth0

iface eth0 inet dhcp

Statically allocated configuration:

auto eth0

iface eth0 inet static

address 192.168.0.1

netmask  255.255.255.0

gateway  192.168.0.1

The configuration requirements (automatically obtain or dynamically assigned) modify the configuration file is saved.

 

2. Add the domain name server: Open the file /etc/resolv.conf

 Add this line: nameserver 202.99.166.4

 

3. Restart Network

$ / Etc / init.d / networking restart (this command is to restart the network card)

or

$ifdown eth0

$ Ifup eth0 (these two commands are targeted to restart a network interface, because a system may have multiple network interfaces)

 

4. View the parameters of the network configuration is not correct (once for each operation can view what is not modify the network configuration)

$ifconfig

 

5. See if it is able to ping

Description of ping nowhere Gateway network configuration problem not ping dns domain description in question

 

Sometimes you need to modify the hardware address of the network card:

method one:

$ifconfig eth0 hw ether XX:XX:XX:XX:XX:XX

$ / Etc / init.d / networking restart (reboot NIC)

Method Two:

These are just a temporary modification of the hardware address to be permanently modified, directly edit / etc / network / interfaces file, add a line at the back iface eth0 inet static: pre-up ifconfig eth0 hw ether xx: xx: xx: xx: xx: xx (to into the MAC)

$ Sudo /etc/init.d/networking restart (reboot NIC)

 

PS:

Instead of adding domain name server in /etc/resolv.conf, or add dns-nameserver xxx.xxx.xxx.xxx in the original / etc / network / interfaces. Because /etc/resolv.conf gone after the restart. And add in / etc / network / interfaces automatically dns server in /etc/resolv.conf of

Guess you like

Origin blog.csdn.net/l641208111/article/details/87025802