Linux-ip address preparation commands

Source: Internet
Author: User
Tags traceroute command
Linux-ip address preparation commands-Linux general technology-Linux technology and application information. For more information, see the following. 1. setup --- Select network configuration.
2. Netconfig
3. Change the configuration file: cd/etc/sysconfig/network-scripts (reboot after modification) or # ifconfig eth0 up or Service network restart

Use vi to change IP-gateway-netmask in the file


(Vi usage Description: vi preparation file; content can be modified after INSERT; Press ESC and press: Enter wq to save and exit; enter Q to save and exit.
4. Redhat-config-network
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.255.248 eth0
# Route add? Net 10.20.30.48 netmask 255.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.255.248 eth0
# Route del? Net 10.20.30.48 netmask 255.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

3. traceroute
You can use the traceroute command to display the route through which the data packet arrives at the target host.
For example:
# Traceroute x

4. ping
You can use the ping command to test network connectivity.
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 network interface status information.
# Netstat? I
(2) display the Socket and the program using the Socket of all monitoring servers.
# Netstat? Lpe
(3) display kernel route table information.
# Netstat? R
# Netstat? Nr
(4) display the connection status of TCP/UDP transmission 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 record corresponding to the IP address and MAC address.
# Arp? S 192.168.33.15 00: 60: 08: 27: CE: B2
(3) Delete A cache record corresponding to an IP address and a MAC address.
# Arp? D192.168.33.15
Network configuration under Ubuntu command line

Edit the/etc/network/interface file as follows:

Add
Auto lo
Iface lo inet loopback
Auto eth0

Add
Iface eth0 inet dhcp

If you manually configure the ip address, add
Iface eth0 inet static
Address xxx. xxx
Netmask xxx. xxx
Network xxx. xxx
Boardcast xxx. xxx
Gateway xxx. xxx
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.