Ubuntu Network Configuration commands

Source: Internet
Author: User
Tags traceroute command

Ubuntu Network Configuration for example:

(1) Configure the IP address of the eth0 and activate the device at the same time. #ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up (2) configures the IP address of the eth0 alias device Eth0:1 and adds the route. The Network configuration command #ifconfig eth0 192.168.1.3 #route add–host 192.168.1.3 Dlinux is ifconfig similar to the ipconfig in Windows command line. You can use the Ifconfig command to configure and view the configuration of network interfaces.

1, such as:
(1) Configure the IP address of the eth0 and activate the device at the same time.
#ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
(2) Configure the IP address of the eth0 alias device eth0:1 and add the route.
#ifconfig eth0 192.168.1.3
#route add–host 192.168.1.3 Dev eth0:1
(3) Activate the device.
#ifconfig eth0 up
(4) Disable the device.
#ifconfig eth0 Down
(5) View the configuration of the specified network interface.
#ifconfig eth0
(6) View all the network interface configuration.
#ifconfig

2. Route
You can use the route command to configure and view the configuration of the kernel routing table.
For example:
(1) The 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) Routes added to the network.
#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.41
#route add–net 192.168.1.0/24 eth1
(3) Add a default gateway.
#route Add default GW 192.168.1.1
(4) View the configuration of the kernel routing table.
#route
(5) 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 255.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
Route 0.0.0.0 GW 172.16.19.254
Service Network Restart

3, Traceroute
You can use the traceroute command to display the routes that the packet has reached to the destination host.
For example:
#traceroute x

4. Ping
You can use the ping command to test the connectivity of your network.
For example:
#ping x
#ping –c 4 192.168.1.12

5, Netstat
You can use the netstat command to display network status information.
For example:
(1) Display the network interface status information.
#netstat –i
(2) Displays the socket of all monitored servers and the program information that is using the socket.
#netstat –lpe
(3) Displays the kernel routing table information.
#netstat –r
#netstat –NR
(4) Displays the connection status of the TCP/UDP transport protocol.
#netstat –t
#netstat –u

6, hostname
You can use the hostname command to change the host name. For example
#hostname Myhost

7. ARP
You can use the ARP command to configure and view the ARP cache. For example:
(1) View the ARP cache.
#arp
(2) Add a corresponding record of IP address and MAC address.
#arp –s 192.168.33.15 00:60:08:27:ce:b2
(3) Delete the corresponding cache record for an IP address and MAC address.
#arp –d192.168.33.15
Network configuration under Ubuntu command line
Edit the/etc/network/interface file as follows
Add first
Auto Lo
Iface Lo inet Loopback
Auto Eth0
If you are getting IP automatically, add
Iface eth0 inet DHCP
If you are configuring IP manually, add
Iface eth0 inet Static
Address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
Network xxx.xxx.xxx.xxx
Boardcast xxx.xxx.xxx.xxx
Gateway xxx.xxx.xxx.xxx
Tags: commands, network, Ubuntu

Ubuntu Network Configuration commands

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.