JAVA modify the default routing configuration (Linux CentOS7 multi-network card)

JAVA modify the default routing configuration (Linux CentOS7 multi-network card)

Existing requirements:
Insert picture description here
modify the default gateway, the default gateway device, take effect immediately, and take effect permanently.

Start to work

Since it is to take effect permanently, first exclude the route add command, you can modify the content of the /etc/sysconfig/network configuration file, and restart the network for implementation.
Insert picture description here
After the test is indeed possible, then open the whole.
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

have a test

Insert picture description here
The network card in my environment enp24s0f1 is configured with an IP of 192.168.113.111, and the default routing network card currently used is enp24s0f0, and the IP is 192.168.113.104.
Insert picture description here
After the change, I found that 104 is not working, and 111 is OK, and it's done.
Insert picture description here
As for the network card configuration
JAVA modify the network card configuration (Linux CentOS7 multi-network card)
query the network card configuration
JAVA to obtain the network card information and default gateway (Linux)

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_38045214/article/details/114748894