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

Source: Internet
Author: User
Tags nameserver

The following values are common in all basic configuration files:
* Device=name, where name is the name of the physical device (except for dynamically assigned PPP devices,
Its name is "logical name".
* Ipaddr=addr, here addr is the IP address.
* Netmask=mask, here Mask is the netmask.
* 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 take one of the following values:
o Yes-the device will be activated at boot.
o No-the device is not activated at boot.
* Userctl=answer, here answer take one of the following values:
o Yes-the non-root user can control the device.
o No--non-root users are not allowed to control the device.
* Bootproto=proto, here Proto take one of the following values:
o None-no boot-time protocol is used.
o BOOTP-uses the BOOTP protocol.
o DHCP-uses the DHCP protocol.

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

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

Device=eth0 Interface Name
Bootproto=none static configuration, if the value is "DHCP" is dynamically obtained, in addition to static IP address is also represented
broadcast=192.168.10.255 broadcast address, automatically computed 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 specified network, automatically computed by IP address and subnet mask
Onboot=yes load automatically when booting
gateway=192.168.10.1
Type=ethernet
Peerdns=yes
Userctl=no

Ifdown Eth0 shut down the network
Ifconfig eth0 Down Network

Ifup eth0 Open Network
Ifconfig eth0 up Open Network

set up DNS /etc/resolv.conf

NameServer 61.144.56.101
NameServer 202.96.128.166

[Email protected] ~]$ cat/etc/resolv.conf
# Generated by NetworkManager
NameServer 202.96.128.86
NameServer 202.96.128.166

other aspects
Service network start//Start networking service
Service network stop//STOP NETWORK Service
Service Network restart//Restart Network Service
Service Network status//View Web service state

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

[[email protected] ~]$ sudo ifconfig wlan0 192.168.21.199 netmask 255.255.255.0
[Email protected] ~]$ 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 txqueuelen:1000
RX bytes:4514869 (4.3 MiB) TX bytes:177732 (173.5 KiB)
Wlan0 represents the first wireless Ethernet card
Link EnCap indicates the name of the network card at the OSI Physical layer (physical layer)
HWADDR represents the MAC address of the network card (Hardware address)
Inet addr Indicates the IP address of the NIC in the TCP/IP network
Bcast for broadcast addresses (Broad address)
Mask represents the subnet mask (Subnet mask)
MTU indicates the maximum transmission unit, different LAN MTU value is not necessarily the same, for Ethernet, the default setting of MTU is 1500 bytes
Metric represents a measure, typically used to calculate routing costs
RX indicates the Received packet
TX represents the Sent packet
Collisions indicates the number of packet collisions
Txqueuelen indicates the length of the routing queue (Transfer queue)
Interrupt indicates the IRQ interrupt number of the NIC
Base address represents I/O address

Configure the virtual network card IP address : Network card needs to have more than one IP address

Command format: Ifconfig NIC name: Virtual network card ID IP address netmask subnet mask

[[email protected] ~]$ sudo ifconfig wlan0:1 192.168.21.188 netmask 255.255.255.0

changing the NIC MAC Address

Ifconfig nic name hw ether MAC address

[Email protected] ~]$ ifconfig wlan0 hw ether 00:11:22:33:44:55


SIOCSIFHWADDR: Operations not allowed
[[email protected] ~]$ sudo ifconfig wlan0 hw ether 00:11:22:33:44:55
SIOCSIFHWADDR: Device or resource busy
[Email protected] ~]$ ifconfig wlan0 down
Siocsifflags: Insufficient Authority
[email protected] ~]$ sudo ifconfig wlan0 down
[[email protected] ~]$ sudo ifconfig wlan0 hw ether 00:11:22:33:44:55
Change succeeded

[[email protected] ~]$ netstat-ant View port Information a all n digital display T TCP protocol u UDP Protocol
Active Internet connections (servers and established established 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 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::: $:::* LISTEN
TCP 0 0:: 1:631:::* LISTEN

[[email protected] ~]$ netstat-r View routing 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

[[email protected] ~]$ netstat-i View network interface status
Kernel Interface Table
Iface MTU Met rx-ok rx-err rx-drp rx-ovr tx-ok tx-err tx-drp TX-OVR FLG
Eth0 0 0 0 0 0 0 0 0 0 BMU
Lo 16436 0 (0 0 0) 0 0 0 LRU
Virbr0 0 0 0 0 0 0 0 0 Bmru
Wlan0 0 10546 0 0 0 7060 0 0 0 Bmru
Wmaster0 0 0 0 0 0 0 0 0 0 0 RU
[Email protected] ~]$

MTU field: represents the maximum transmission unit, which is the maximum value of the network interface transmission packet.
Met field: represents a measure, and the smaller the priority, the greater the value.
Rx-ok/tx-ok : Indicates the number of packets received and sent separately.
Rx-err/tx-err : Indicates the number of error packets received and sent.
RX-DRP/TX-DRP : represents the number of discards.
RX-OVR/TX-OVR : Indicates the number of packets lost.

[[email protected] ~]$ 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

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

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.