Linux basic network configuration
1.View Network Interface Information
Ifconfig view Network Interface Information (/sbin/ifconfig)
Ifconfig [network interface]
Ifconfig-A: View information of all network interfaces in the system
2.View gateway address and route information
Route view host route information (/sbin/route)
Route | grep default
Display the default gateway address
Ping the target host address to test network connection with other hosts
CTRL + C run the ping command
Ping-C [number of test packets] [destination host address]
Send a specified number of data packets for Network Testing
Traceroute [destination host address] test the network connection path with other hosts
3.View Host Name Information
Hostname: view the Host Name of the current host
Hostname [soul.com] Change the Host Name (disappears after restart)
VI/etc/sysconfig/network change host name (effective after restart)
~ # Grep Hostname/etc/sysconfig/Network
Hostname = soul.com
4.UseDNSServer query domain name
NSLookup domain name query
Exit to exit the switching Environment
5.
IPAddress Configuration command
Network Settings
Dhclient applies a new network configuration from the DHCP server to the current Linux host.
Ifconfig [network interface name] [IP address] netmask [subnet mask]
Configure IP addresses
--------------------------------------------------------------------
Route Configuration
Route add default GW [default gateway address] add Default Gateway route
Route del default GW [default gateway address]
Delete a default gateway route
--------------------------------------------------------------------
Use tools for Network Configuration
Configure the network in the netconfig window
--------------------------------------------------------------------
Network Service Startup Script
/Etc/init. d/network restart reset the network attribute of the current system (otherwise the new configuration will take effect the next time the system starts)
/Etc/init. d/network stop NETWORK SERVICE
CAT/etc/sysconfig/network-scripts/ifcfg-eth0 view eth0 Interface Configuration
Ifdown [Network Interface Name] Stop Network Interface
IFUP [Network Interface Name] Start Network Interface
Ifdown eth0; IFUP eth0 close the interface and start to make the network configuration take effect
6.
MacAddress Settings
/Sbin/ifconfig eth0 down disable eth0 Interface
/Sbin/ifconfig eth0 HW ether 00: 0C: 11: 22: 33: 10
/Sbin/ifconfig eth0 up
7.Local host name parsing File
CAT/etc/hosts saves the corresponding records of the local host name and IP address
Add more records of IP addresses and host names to VI/etc/hosts
8.Domain Name Server Configuration File
CAT/etc/resolv. conf query the DNS server used for domain name resolution
From http://blog.163.com/hnwbo_wanderer/blog/static/16326829020104352127946/