Ip address, Gateway-settings, modification, and common commands in CentOS

Source: Internet
Author: User
About settings: you can manually modify the network address or add a new network interface to the new interface by modifying the corresponding file (ifcfg-ethN) or creating a new file. DEVICE = namename indicates the name of the physical DEVICE. IPADDR = addraddr indicates the IP address assigned to the card. NETMASK = mask about settings:

 

You can manually modify the network address or add a new network interface to the new interface by modifying the corresponding file (ifcfg-ethN) or creating a new file.
DEVICE = name indicates the name of the physical DEVICE.
IPADDR = addr indicates the IP address assigned to the card
NETMASK = mask indicates the network mask
NETWORK = addr indicates the NETWORK address
BROADCAST = addr indicates the BROADCAST address.
ONBOOT = yes/no whether the card is activated at startup

 

GATEWAY = 192.168.1.102 GATEWAY address
None: no startup protocol required
Bootp: Use the bootp protocol
Dhcp: Use the dhcp protocol.
USERCTL = yes/no whether non-root users are allowed to control the device

Modify: the parameters of DEVICE = include dhcp and static, respectively, indicating dynamic and static receiving,

 

Content in eth0 (static IP address:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE = eth0
BROADCAST = 192.168.1.255
BOOTPROTO = static
IPADDR = 192.168.1.56
NETMASK = 255.255.255.0
NETWORK = 192.168.1.1
GETEWAY = 192.168.1.102
PEERDNS = no
ONBOOT = yes
Content in eth1 (dynamic receiving IP address:

# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE = eth1
BOOTPROTO = dhcp
ONBOOT = yes
HWADDR = 00: 0c: 29: 9b: 0e: f9

Add a temporary IP address command: ifconfig eth0 192.168.1.12 netmask 255.255.255.0

Add a temporary Gateway command: route add default gw 192.168.1.102

The preceding two commands are unavailable after the NIC is restarted (service network restart ).

View:

Available

Netstat-nr and route-nv view the ip address and Gateway Information of eth0 and eth1;

Ip route show: view the corresponding information of each network card

Related Article

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.