To prepare the NIC configuration of a fixed ip address in Ubuntu, you must first understand the vi command. You can learn about it at any time by google: 1. Single NIC with Single IP (common) vi/etc/network/interfaceautoeth0ifaceeth0inetstaticaddressIPnetmask subnet mask gateway 2. Single Nic Dual IP (relatively
To prepare the NIC configuration of a fixed ip address in Ubuntu, you must first understand the vi command, so you can understand it at google:
1. Single NIC with Single IP address (common)
Vi/etc/network/interface
Auto eth0
Iface eth0 inet static
Address IP
Netmask Subnet Mask
Gateway
2. Dual IP addresses for a single NIC (in rare cases, most of which are used to differentiate services or hide Security)
Vi/etc/network/interface
Auto eth0: 0
Iface eth0: 0 inet static
Address IP
Netmask Subnet Mask
Gateway
Auto eth0: 1
Iface eth0: 1 inet static
Address IP
Netmask Subnet Mask
Gateway
3. Dual-network card Dual IP (many applications, usually one Intranet and one Internet)
Auto eth0
Iface eth0 inet static
Address IP
Netmask Subnet Mask
Gateway
Auto eth1
Iface eth1 inet static
Address IP
Netmask Subnet Mask
Gateway
In summary, after the configuration is saved and released, you usually need to restart the NIC to make the settings take effect. There are many methods, such as ifdown eth0 and ifup eth0. The most direct method is to directly type/etc/init on the terminal. d/networking restart
DNS is the same, as shown below:
Vi/etc/resolv. conf (the file resolv. conf does not exist by default in the system and is created by yourself)
Nameserver primary DNS
Nameserver backup DNS