How to modify network parameters such as IP, Mac, netmask, and gateway in Linux (2)

Source: Internet
Author: User
Tags nameserver

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

The configuration file of the wireless network card cannot be found in this directory. This is strange.

# RealTek semiconduco., Ltd. RTL-8139/8139c/8139c +
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 a virtual NicIPAddress: The NIC 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 NicMacAddress

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 ~] $

MTUField:Indicates the maximum transmission unit, that is, the maximum value of data packets transmitted by network interfaces.
MetField:Indicates the metric value. The smaller the value, the higher the priority.
RX-OK/TX-OK:The number of packets received and sent.
RX-ERR/TX-ERR:Number of error packets received and sent.
RX-DRP/TX-DRP:Indicates the number of dropped items.
RX-OVR/TX-OVR:The number of dropped data 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.

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.