Linux service configuration linux system routing configuration

  

A linux system network related commands: network configuration files in /etc/sysconfig/network-scripts/*.

mii-tool -v View the specific parameters of the network card.

ethtool

lscpu , lsusb , lsblk, lspci -v View information about each hardware.


1. ifconfig eth0 ip_address netmask net_mask Modify the ip address and subnet mask of the NIC

2. ifconfig eth0 ip_address/24 Configure ip address and subnet mask

3. ifconfig eth0 down/up Disable the NIC, do not reload the NIC configuration file /etc/sysconfig/network-scripts/ifcfg-eth0

4.ifconfig eth0 hw ether MAC_Address Configure the MAC address

5. ifconfig eth0:1 IP_Address Configure Virtual Network Interface

6. iwconfig Configure the wireless network card.


7. arp -n View arp table

8. arp -s Ip_address Mac_address Statically bind MAC address


9. route -n View routing table

10. traceroute traceroute

2: Configure the Linux system as a router Step:

1. Enable route forwarding:

a. sysctl -w net.ipv4.ip_forward=1 The route forwarding function is temporarily valid and the restart is invalid.

b. echo 1 > /proc/sys/net/ipv4/ip_forward Temporarily valid, suitable for scripts.

c. Modify the /etc/sysctl.conf file and change the value of the net.ipv4.ip_forward variable to 1. Enter sysctl -p to restart the configuration file.

2. Add default routes and static routes

a. route add default gw IP_address Add a default route.

b. route del default Delete default route

c. route add -net network address gw IP_address Add a static route.

d. route del -net Network address gw Ip_address Delete static route

e. vi /etc/sysconfig/network-scipts/route-eth0 Then add the static route format to the file as follows:

network/24 via IP_address This addition method is a permanent static route.

Three: The solution to the virtual machine cloning network card failure.

1. Empty the contents of the /etc/udev/rules.d/70-persistent-net.rules file.

2. Delete the /etc/sysconfig/network-scipts/ifcfg-ethX file.

3.Re-add the network card

Copyright © Windows knowledge All Rights Reserved