Manually configure the network under the Ubuntu command line

Source: Internet
Author: User
Tags traceroute command
The network configuration command under Linux is ifconfig similar to the ipconfig in the Windows command line. You can use the Ifconfig command to configure and view the configuration of network interfaces. For example: (1) Configure the IP address of the eth0 while activating the device. #ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up (2) configures the IP address of eth0 alias device Eth0:1 and adds a route. #ifconfig eth0 192.168.1.3 #route add–host 192.168.1.3 Dev eth0:1 (3) activates the device. #ifconfig eth0 Up (4) disables the device. #ifconfig eth0 Down (5) To view the configuration of the specified network interface. #ifconfig eth0 (6) To view all network interface configurations. #ifconfig 2, Route can use the route command to configure and view the configuration of the kernel routing table. For example: (1) A route added to the host. #route add–host 192.168.1.2 Dev eth0:0 #route add–host 10.20.30.148 GW 10.20.30.40 (2) is added to the network route. #route add–net 10.20.30.40 netmask 255.255.255.248 eth0 #route add–net 10.20.30.48 netmask 255.255.255.248 GW 10.20.30.4 1 #route add–net 192.168.1.0/24 eth1 (3) adds a default gateway. #route Add default GW 192.168.1.1 (4) To view the configuration of the kernel routing table. #route (5) to delete the route. #route del–host 192.168.1.2 Dev eth0:0 #route del–host 10.20.30.148 GW 10.20.30.40 #route del–net 10.20.30.40 netmask 2 55.255.255.248 eth0 #route del–net 10.20.30.48 netmask 255.255.255.248 GW 10.20.30.41 #route del–net 192.168.1.0/24 eth1 #route del default GW 192.168.1.1 for 1 and 22 points can be implemented using the following statement: Ifconfig eth0 172.16.19.71 netmask 255.255.255.0, Rou Te 0.0.0.0 GW 172.16.19.254 Service Network Restart 3, traceroute you can use the traceroute command to display the route the packet has reached to the destination host. For example, #traceroute x 4, ping can use the ping command to test the connectivity of the network. For example: #ping x #ping –c 4 192.168.1.12 5, Netstat can use the netstat command to display network state information. For example: (1) Display network interface status information. #netstat – I (2) displays the socket for all servers in the monitor and the program information that is using the socket. #netstat –lpe (3) Displays kernel routing table information. #netstat –r #netstat –nr (4) shows the connection status of the TCP/UDP transport protocol. #netstat –t #netstat –u 6, hostname can use the hostname command to change the host name. For example #hostname myhost 7, ARP can use the ARP command to configure and view the ARP cache. For example: (1) View the ARP cache. #arp (2) adds a corresponding record of an IP address and a MAC address. #arp –s 192.168.33.15 00:60:08:27:ce:b2 (3) deletes a corresponding cache record for an IP address and MAC address. #arp –d192.168.33.15 Ubuntu command line network configuration edit/etc/network/interface file is as follows add Auto lo iface lo inet loopback auto eth0 If you are automatically getting IP, Add iface eth0 inet DHCP If you are manually configuring IP, add iface eth0 inet static address xxx.xxx.xxx.xxx netmask xxx.xxx.xxx.xxx network xxx.xx X.xxx.xxx boardcast xxx.xxx.xxx.xxx Gateway XXx.xxx.xxx.xxx

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.