Linux network interface configuration file
Last Update:2014-05-15
Source: Internet
Author: User
Linux network interface configuration file [root @ localhost ~] Catetcsysconfignetwork-scriptsifcfg-eth0IntelCorporation82545EMGigabitEthernetController (Copper) TYPE = Ether linux network interface configuration file [root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) TYPE = Ethernet # Nic type device = eth0 # Nic 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 profile [root @ localhost ~] #/Etc/init. d/network reloadShutting 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 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 statusConfigured devices: lo eth0Currently 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 ~] # Ifconfigeth0 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: 0x2000 Memory: 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) view the current route and Gateway Information [root @ localhost ~] # Netstat-rKernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Iface192.168.1.0 * 255.255.255.0 U 0 0 255.* 255.255.0.0 U 0 0 0 eth0default 192.168.1.1 0.0.0.0 UG 0 0 0 0 eth0 DNS: host name: centOS Primary DNS: 202.106.46.151 secondary 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 DEVICE = 255.= 255.255.255.0BROADCAST = 255.= yesBOOTPROTO = noneGATEWAY = 192.168.1.1TYPE = Ethernet "/etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 187C