Ifcfg-eth0 Configuration

Source: Internet
Author: User
Tags nameserver

Original link http://blog.csdn.net/pheror_abu/archive/2010/05/27/5628737.aspx

 

From: http://hi.baidu.com/lei005/blog/item/92df5e8314544a9cf703a648.html
/Etc/sysconfig/network includes the basic network information of the host for system startup.

/Etc/sysconfig/network-script/the directory contains the information about the most initialized network started by the system.

/Etc/sysconfig/network-script/ifcfg-eth0 network configuration information

/Etc/xinetd. conf defines the network service started by the super process xinetd.

/Etc/protocols sets the protocol used by the host and the protocol numbers of each Protocol

/Etc/services: network services with different ports on the host

// Network Configuration Tool
Ifcfg-eth0 Configuration

File:/etc/sysconfig/network-scripts/ifcfg-eth0

 

The following values are common in all basic configuration files:
* Device = Name. Here, name is the name of the physical device (except for the dynamically allocated PPP device,
Its name is "logical name ".
* Ipaddr = ADDR. Here ADDR is the IP address.
* Netmask = mask. Here, the mask is the network mask.
* Network = ADDR. Here, ADDR is the network address.
* Broadcast = ADDR. Here, ADDR is the broadcast address.
* Gateway = ADDR. Here, ADDR is the gateway address.
* Onboot = answer. Here, answer takes one of the following values:
O yes -- the device will be activated during boot.
O no -- this device is not activated during boot.
* Userctl = answer. Here, answer takes one of the following values:
O yes -- Non-root users can control the device.
O no -- Non-root users are not allowed to control the device.
* Bootproto = proto, where proto takes one of the following values:
O none -- protocol when boot is not used.
O bootp -- use the BOOTP protocol.
O dhcp-use the DHCP protocol.

**************************************** *********************************

/Etc/sysconfig/network-scripts/ifcfg-eth0

Device = eth0 Interface Name
Bootproto = none static configuration. If this value is "DHCP", it is dynamically obtained. Static also indicates static IP address.
Broadcast = 192.168.10.255 broadcast address, automatically calculated by IP address and subnet mask
Hwaddr = 00: 13: D3: 27: 9f: 80
Ipaddr = 192.168.10.238
Ipv6init = Yes
Ipv6_autoconf = Yes
Netmask = 255.255.255.0
Network = 192.168.10.0 indicates the network, which is automatically calculated using the IP address and subnet mask.
Onboot = Yes automatically loaded upon startup
Gateway = 192.168.10.1
Type = Ethernet
Peerdns = Yes
Userctl = No

Ifdown eth0 disable network
Ifconfig eth0 down disable network

IFUP eth0 enable Network
Ifconfig eth0 up enable Network

Set DNS/etc/resolv. conf

Nameserver 61.144.56.101
Nameserver 202.96.128.166

[Yeger @ yeger ~] $ CAT/etc/resolv. conf
# Generated by NetworkManager
Nameserver 202.96.128.86
Nameserver 202.96.128.166

Other aspects
Service Network start // start a network service
Service Network stop // stop a network service
Service Network restart // restart the network service
Service Network Status // view the network service status

Ifconfig eth0 192.168.10.222 netmask 255.255.255.0 // temporarily modify the interface IP address (no need to restart the interface)

[Yeger @ yeger ~] $ Sudo ifconfig wlan0 192.168.21.199 netmask 255.255.255.0
[Yeger @ yeger ~] $ Ifconfig wlan0
Wlan0 link encap: Ethernet hwaddr 00: 02: 72: 77: BB: d1
Inet ADDR: 192.168.21.199 bcast: 192.168.21.255 mask: 255.255.255.0
Inet6 ADDR: fe80: 202: 72ff: fe77: bbd1/64 scope: Link
Up broadcast running Multicast MTU: 1500 Metric: 1
RX packets: 3246 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1947 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 4514869 (4.3 MIB) TX Bytes: 177732 (173.5 kib)
Wlan0 indicates the first wireless Ethernet Card
Link encap indicates the name of the network adapter in the OSI physical layer.
Hwaddr indicates the MAC address of the NIC (hardware address)
Inet ADDR indicates the IP address of the network adapter in the TCP/IP network.
Bcast indicates the broadcast address (broad address)
Mask indicates the subnet mask (subnet mask)
MTU indicates the maximum transmission unit. MTU values are not necessarily the same for different local networks. For Ethernet, the default MTU value is 1500 bytes.
Metric indicates the metric value, which is usually used to calculate the route cost.
RX indicates the received data packet
TX indicates the sent data packet
Collisions indicates the number of packet conflicts
Txqueuelen indicates the transfer queue length.
Interrupt indicates the IRQ interrupt Number of the ENI.
Base Address indicates the I/O address

Configure the virtual network interface IP Address: the network interface must have multiple IP addresses.

Command Format: ifconfig Nic name: Virtual Nic id ip address netmask Subnet Mask

[Yeger @ yeger ~] $ Sudo ifconfig wlan0: 1 192.168.21.188 netmask 255.255.255.0

Change the nic mac address

Ifconfig Nic name HW ether MAC address

[Yeger @ yeger ~] $ Ifconfig wlan0 HW ether 00: 11: 22: 33: 44: 55

Siocsifhwaddr: operation not allowed
[Yeger @ yeger ~] $ Sudo ifconfig wlan0 HW ether 00: 11: 22: 33: 44: 55
Siocsifhwaddr: the device or resource is busy.
[Yeger @ yeger ~] $ Ifconfig wlan0 down
Siocsifflags: insufficient Permissions
[Yeger @ yeger ~] $ Sudo ifconfig wlan0 down
[Yeger @ yeger ~] $ Sudo ifconfig wlan0 HW ether 00: 11: 22: 33: 44: 55
Changed

[Yeger @ yeger ~] $ Netstat-ant view port information a all N numbers display t TCP protocol u udp protocol
Active Internet connections (servers and established have established a connection)
PROTO Recv-Q send-Q local address foreign address State
Protocol local address remote address connection status
Type
TCP 0 0 0.0.0.0: 57798 0.0.0.0: * Listen listen indicates the listening status
TCP 0 0 0.0.0.0: 111 0.0.0.0: * listen
TCP 0 0 192.168.122.1: 53 0.0.0.0: * listen
TCP 0 0 0.0.0.0: 22 0.0.0.0: * listen
TCP 0 0 127.0.0.1: 631 0.0.0.0: * listen
TCP 0 0 127.0.0.1: 25 0.0.0.0: * listen
TCP 0 0: 111: * listen
TCP 0 0: 22: * listen
TCP 0 0: 1: 631: * listen

[Yeger @ yeger ~] $ Netstat-r view route table
Kernel IP routing table
Destination gateway genmask flags MSS window irtt iface
192.168.21.0*255.255.255.0 u 0 0 0 wlan0
192.168.122.0*255.255.255.0 u 0 0 0 virbr0
Default 192.168.21.1 0.0.0.0 ug 0 0 0 wlan0

[Yeger @ yeger ~] $ Netstat-I view the network interface status
Kernel interface table
Iface MTU met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR flg
Eth0 1500 0 0 0 0 0 0 0 0 BMU
Lo 16436 0 230 0 0 230 0 0 0 LRU
Virbr0 1500 0 0 0 0 29 0 0 0 bmru
Wlan0 1500 0 10546 0 0 7060 0 0 0 bmru
Wmaster0 0 0 0 0 0 0 0 0 0 Ru
[Yeger @ yeger ~] $

MTU field: indicates the maximum transmission unit, that is, the maximum number of packets transmitted by network interfaces.
Met field: indicates the metric value. The smaller the value, the higher the priority.
RX-OK/TX-OK: number of packets received and sent, respectively.
RX-ERR/TX-ERR: Number of error packets received and sent.
RX-DRP/TX-DRP: indicates the number of dropped.
RX-OVR/TX-OVR: indicates the number of dropped packets.

[Yeger @ yeger ~] $ NSLookup www.baidu.com test domain name resolution
Server: 202.96.128.86
Address: 202.96.128.86 #53

Non-Authoritative Answer:
Www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 121.14.89.10
Name: www.a.shifen.com
Address: 121.14.88.76

The IP address of Baidu is 121.14.89.10.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/pheror_abu/archive/2010/05/27/5628737.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.