Ifcfg-eth0 configuration in linux
Last Update:2014-05-30
Source: Internet
Author: User
Linux ifcfg-eth0 configuration network interface configuration file [root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0 # intelconfiguration82545emgigabitethernetcontroller (Copper) TYPEEthernet # network.
Linux ifcfg-eth0 configuration network interface configuration file [root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) TYPE = Ethernet # network adapter TYPE www.2cto.com DEVICE = eth0 # network adapter interface name ONBOOT = yes # whether to automatically load BOOTPROTO = static when the system starts # enable address protocol -- static: static protocol -- bootp protocol -- dhcp protocol IPADDR = 192.168.1.11 # nic ip address NETMASK = 255.255.255.0 # Nic network address GATEWAY = 192.168.1.1 # Nic GATEWAY address DNS1 = 10.203.104.41 # Nic DNS address HWADDR = 00: 0C: 29: 13: 5D: 74 # Nic device MAC address BROADCAST = 192.168.1.255 # Nic BROADCAST address
Re-import ifcfg-eth0 network configuration file [root @ localhost ~] #/Etc/init. d/network reload Shutting down interface eth0: [OK] Shutting down loopback interface: [OK] Bringing up loopback interface: [OK] Bringing up interface eth0: [OK] disable and activate the Nic interface [root @ localhost ~] # Ifdown eth0 # Disable the network [root @ localhost ~] # Ifup eth0 # start and close the network service
Method 1: [root @ localhost ~] # Service network stop # Disable the network service [root @ localhost ~] # Service network start # start the network service [root @ localhost ~] # Service network restart # Method 2: [root @ localhost ~] #/Etc/init. d/network stop [root @ localhost ~] #/Etc/init. d/network start [root @ localhost ~] #/Etc/init. d/network restart NIC status query [root @ localhost ~] # Service network status Configured devices: lo eth0 www.2cto.com Currently active devices: lo eth0 configure the Nic information temporarily without restarting. [Root @ localhost ~] # Ifconfig eth0 10.1.1.10 netmask 255.0.0.0
View Nic interface information. all interfaces are listed by default. [root @ localhost ~] # Ifconfig eth0 Link encap: Ethernet HWaddr 00: 0C: 29: 13: 5D: 74 inet addr: 192.168.1.11 Bcast: 192.168.1.255 Mask: 255.255.255.0 inet6 addr: fe80: 20c: 29ff: fe13: 5d74/64 Scope: Link up broadcast running multicast mtu: 1500 Metric: 1 RX packets: 413 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 572 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 1000 RX bytes: 47701 (46.5 KiB) TX bytes: 64842 (63.3 KiB) Base address: 0x2000Memory: d8920000-d8940000 lo Link encap: Local Loopback inet addr: 127.0.0.1 Mask: 255.0.0.0 inet6 addr: 1/128 Scope: Host up loopback running mtu: 16436 Metric: 1 RX packets: 407 errors: 0 dropped: 0 overruns: 0 frame: 0 TX packets: 407 errors: 0 dropped: 0 overruns: 0 carrier: 0 collisions: 0 txqueuelen: 0 RX bytes: 70759 (69.1 KiB) TX bytes: 70759 (69.1 KiB) www.2cto.com
View the current route and Gateway Information [root @ localhost ~] # Netstat-r Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.1.0*255.255.255.0 U 0 0 0 eth0 169.254.0.0*255.255.0.0 U 0 0 0 eth0 default 192.168.1.1 0.0.0.0 UG 0 0 0 0 0 DNS: host Name: CentOS Primary DNS: 202.106.46.151 second DNS: 202.106.0.20 third DNS: 8.8.8.8 network configuration: eth0 static IP: 192.168.1.106 subnet mask 255.255.255.0 Default gateway IP 192.168.1.1 255.device = mask = 192.168.1.20.netmask = 255.255.255.0BROADCAST = mask = yesBOOTPROTO = noneGATEWAY = 192.168.1.1TYPE = Ethernet "/etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 187C