Ubuntu network configuration file

Source: Internet
Author: User
Tags nameserver
The network configuration files of Ubuntu include the IP address configuration file, host name configuration file, and DNS configuration file. IP Address Configuration File: After opening/etc/network/interfaces, you can set DHCP or manually set static IP addresses. In front of autoeth0, enable the NIC to automatically mount upon startup. 1. Configure the NIC to edit the file/etc/network/interfaces: sudovi/etc/network/inter in DHCP Mode

The network configuration files of Ubuntu include the IP address configuration file, host name configuration file, and DNS configuration file.

IP Address Configuration File:/etc/network/interfaces
After it is enabled, you can set DHCP or manually set static IP addresses. Auto eth0 in front to enable automatic Nic mounting.

1. Configure the NIC in DHCP Mode

Edit the file/etc/network/interfaces:
Sudo vi/etc/network/interfaces

Replace eth0 with the following rows:
# The primary network interface-use DHCP to find our address
Auto eth0
Iface eth0 inet dhcp

Run the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart
You can also enter the following command in the command line to obtain the address.
Sudo dhclient eth0

2. configure a static IP address for the NIC

Edit the file/etc/network/interfaces:

Sudo vi/etc/network/interfaces

Replace eth0 with The following rows: # The primary network interface
Auto eth0
Iface eth0 inet static
Address 192.168.3.90
Gateway 192.168.3.1
Netmask 255.255.255.0

Replace the preceding IP address and other information with your own. Use the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart

3. Set the second IP address (virtual IP address)

Edit the file/etc/network/interfaces: sudo vi/etc/network/interfaces

Add the following lines to the file:
Auto eth0: 1
Iface eth0: 1 inet static
Address 192.168.1.60
Netmask 255.255.255.0
Network x. x
Broadcast x. x
Gateway x. x

Fill in all information such as address, netmask, network, broadcast, and gateways according to your situation.
Run the following command to make the network settings take effect:
Sudo/etc/init. d/networking restart

Host Name configuration file (/bin/hostname)

Run the following command to view the Host Name of the current host:

Sudo/bin/hostname

Run the following command to set the Host Name of the current host:

Sudo/bin/hostname newname

When the system starts, it reads the host name from/etc/hostname.


DNS configuration file

First, you can add some host names to/etc/hosts and the IP addresses corresponding to these host names. This is a simple static query on the local machine.

To access the DNS server for query, you need to set the/etc/resolv. conf file.
Sudo vi/etc/resolv. conf

Nameserver 202.96.128.68

Nameserver 61.144.56.101

Nameserver 192.168.8.220

/Reset the network to enable new settings

Sudo/etc/init. d/networking restart

OK.

The network configuration files of Ubuntu include the IP address configuration file, host name configuration file, and DNS configuration file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.