Linux Basic Network Configuration | gateway Query

Source: Internet
Author: User
Tags domain name server

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.
IP
Address 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.
Mac
Address 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/

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.