Tips for setting up IPv4 in Ubuntu system

  
                

IPv4 is the first protocol that is widely used to form the cornerstone of today's Internet technologies. In the Ubuntu system, we also need to set it up. If you are not sure how to set up friends, study this tutorial carefully.

Setting IPv4 is mainly to edit the two files /etc/network/interfaces and /etc/resolv.conf. The former sets the ip address, gateway, subnet mask, and the latter sets the attributes such as dns.

Example:

1. In DHCP arranged NIC

Edit file /etc /network /interfaces:

sudo vi /etc /Network/interfaces

and replace the line for eth0 with the following line:

# The primary network interface - use DHCP to find our address

auto eth0

iface eth0 inet dhcp

Use the following command to make the network settings take effect:

sudo /etc/init.d/networking restart

can also be directly from the command line Enter the following command to get 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

and replace the line for eth0 with the following line: # The primary network interface

auto eth0

iface eth0 inet static< Br>

address 192.168.3.90

gateway 192.168.3.1

netmask 255.255.255.0

#network 192.168.3.0

#broadcast 192.168.3.255

Change the above ip address and other information to yourself. 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 line to the file:

auto eth0:1

iface eth0:1 inet static

address 192.168.1.60

netmask 255.255.255.0

network xxxx

broadcast xxxx

gateway xxxx

Fill in all the addresses such as address according to your situation. Netmask, network, broadcast, and gateways.

Use the following command to make the network settings take effect:

sudo /etc/init.d/networking restart

4. Configuration DNS

First, you can add some hostnames and IP addresses corresponding to these hostnames in /etc/hosts, which is a simple static query using this machine.

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

Assuming the IP address of the DNS server is 192.168.3.2, the contents of the /etc/resolv.conf file should be :

nameserver 192.168.3.2

The above is about setting up IPv4 in Ubuntu system. Have you learned the tutorials of this tutorial? If you have more simple Method, welcome to interact with Xiaobian message.

Copyright © Windows knowledge All Rights Reserved