Linux (centos) Nic configuration Manual

Source: Internet
Author: User
Tags nameserver

1. Configuration File
/Etc/hosts (the local host IP address ing can have multiple aliases ).
/Etc/services (correspondence between port numbers and standard services ).

/Etc/sysconfig/Network (set the host name, gateway, and domain name ).
Hostanme = zjw.com (host name) (effective only when the computer is restarted)
Gateway = 192.168.1.1 (GATEWAY)

/Etc/rc. d/init. d/network restart (script Service Startup)
Service Network restart (same as above, for command execution)

2. DNS-related
/Etc/host. conf
/Etc/nsswitch. conf
/Etc/resolv. conf (configure DNS)

VI resolv. conf

Nameserver 202.96.128.68

Nameserver 219.136.241.206

3. Nic configuration file
/Etc/sysconfig/network-scripts/ifcfg-eth0
Device = eth0 (which Nic)
Onboot = Yes
Bootproto = static (static IP status settings)
Bootproto = DHCP (obtained through DHCP)
Ipaddr = 192.168.1.8 (static IP address)
Netmask = 255.255.255.0
Gateway = 192.168.1.1 (GATEWAY) (if the gateway is set here, the above is invalid)
Macaddr = 00: 0C: 29: 96: 38: F8 (modify the MAC address) (permanently valid)
/Etc/rc. d/init. d/network restart (script startup)
Service Network restart (command start)

4. IP configuration method and automatic IP address acquisition
Ifconfig eth0 192.168.0.10 will use the default Subnet Mask
Ifconfig eth0 192.168.0.10 netmask 255.255.255.252 (manually define the subnet mask)
Ifconfig eth0 up (enable Nic)

/Etc/sysconfig/network-scripts/IFUP eth0 (the script activates the NIC) or
IFUP eth0 (symbolic link to/sbin/IFUP ). Note: It seems invalid to modify the MAC address. Remember.

Ifconfig eth0 down (disable Nic)
/Etc/sysconfig/netowrk-scripts/ifdown eth0 (the script closes the NIC) or
Ifdown eth0 (symbolic link to/sbin/ifdown)

Netconfig
Is a command to set IP addresses in the form of a text window. After modification, use
Service Network restart (for configuration parameters to take effect)

Ifconfig eth0-dynamic (manually set to obtain the dhcp ip address)

5. Modify the MAC address
Ifconfig eth0 down
Ifconfig eth0 HW ether 00: 00: 0C: 12: 34: 56
/Etc/RD. d/init. d/network (the above changes can be stored in this script)
Ifconfig eth0 up
# The above method is modified in the kernel and will be restored at next boot.
Add the following to the NIC configuration file permanently:
Macaddr = 00: 00: 0C: 12: 34: 56
/Etc/sysconfig/network-scripts/ifcfg-eth0

6. Common Test commands
Ping-C 4 172.16.1.1
Route (perform operations on the kernel's IP route table, mainly set Static Routing for the host or network of the configured interface, such as configuring through ifconfig)
Route add-net 192.168.1.0 netmask route 255.255.0 eth0 (add a route entry to the 192.168.1.0 Network)
Route del-net 192.168.1.0 netmask 255.255.255.0 (delete route entries)
View the buffer table in route-C
Route-n view the local route table
Traceroute route tracking
Note: netconfig, ifconfig, and route are used in combination without restarting the system and service.

7. Create an ADSL connection
Rpm-Qa | grep RP-pppoe
Rpm-ivh rp-pppoe * (cd)
Route del default (delete the default route)
ADSL-setup (set connection)
ADSL-start (connection test)
ADSL-status (view status)

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.