Manually configure the network under the UBUNTU command line

Source: Internet
Author: User
In LINUX, the network configuration command ifconfig is similar to ipconfig in the WINDOWS command line. You can use the ifconfig command to configure and view the network interface configuration. For example: (1) configure the IP address of eth0 and activate the device. # Ifconfigeth0192.168.1.10netmask1_255.255.0up (2) configure the IP address of eth0 alias device eth0: 1 and add a route. # Ifconfige In LINUX, the network configuration command ifconfig is similar to ipconfig in the WINDOWS command line. You can use the ifconfig command to configure and view the network interface configuration.
For example:
(1) configure the IP address of eth0 and activate the device.
# 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 a 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 network interface configurations.
# Ifconfig
2. route
You can use the route command to configure and view the configuration of the kernel route table.
For example:
(1) 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) route 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 route table.
# Route
(5) delete a 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
You can use the following statement to implement steps 1 and 2:
Ifconfig eth0 172.16.19.71 netmask 255.255.255.0
Route 0.0.0.0 gw 172.16.19.254
Service network restart
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.