Article title: Comparison of Redhat and Ubuntu Nic configuration methods. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Set a fixed ip address for the NIC in Redhat linux
Previously, the redhat-config-network setting of the NIC fixed ip address in xwindow did not work. after the redhat-config-network is set, the ping fails. Check some information, change/etc/sysconfig/network-scripts/ifcfg-eth0 (the first Nic is eth0), configure the dns file as/etc/resolv. conf, I keep the dhcp configuration. After configuration, use ifconfig eth0 down; ifconfig eth0 up. The following is a configuration file list:
#/Etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE = eth0
BOOTPROTO = static
BROADCAST = 192.168.1.255
IPADDR = 192.168.1.10
NETMASK = 255.255.255.0
NETWORK = 192.168.1.0
HWADDR = 52: 54: AB: 2F: CF: F0
GATEWAY = 192.168.1.1
ONBOOT = on
TYPE = Ethernet
#/Etc/resolv. conf
Nameserver 202.109.14.5
Nameserver 202.96.209.5
Search localdomain
Or run the following command: setup
Or:
Route add-net 192.168.1.50 netmask 255.255.255.0 dev eth0
Or:
Ifconfig eth0 192.168.1.50 netmask 255.255.255.0
Ubuntu Nic settings, ip, mask, gateway, dns
Sudo vi/etc/network/interfaces
// This should determine whether to enable this port
Auto eth0
// Set the IP address statically
Iface eth0 inet static
Address 172.16.146.200
Netmask 255.255.255.0
# Broadcast 172.16.146.255
Gateway 172.16.146.254
// Dynamic settings through dhcp
Iface eth0 inet dhcp
// Set the DNS server
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 the new settings
Sudo/etc/init. d/networking restart
// OK