I am using CentOS 7 (yes I know it's old). I have eth0 which is default for PXE booting and local network access. I also have eth1 which I like to use for internet access and remote access via ssh port 22 or 23 to eth1. How can I achieve this? I search and try different configuration but can't get it to work. I like to learn so pls explain your answer. Thanks.

# ip route
default via dev eth0
default via dev eth1 proto static metric 102 dev eth1 proto kernel scope link src metric 102 dev eth0 proto kernel scope link src

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0         UG    102    0        0 eth1     U     102    0        0 eth1   U     0      0        0 eth0

1 Answer 1


PXE implies you probably get the network settings for eth0 using DHCP.

What kind of settings do you use for eth1 (static or DHCP)?

Are you using NetworkManager or classic ifcfg-<interface> files to configure your network interfaces? (What is the output of nmcli c show?)

You would have to configure the DHCP client for eth0 to ignore any default gateway setting provided by the DHCP server, or to assign a higher-than-normal (and higher than 102) metric value for it. Then you would have to ensure that eth1's default gateway is valid.

With NetworkManager, you could achieve this by setting the ipv4.never-default attribute to TRUE for the connection of eth0. For example:

nmcli connection modify <connection_name_of_eth0> ipv4.never-default TRUE

Of course you should replace the <connection_name_of_eth0> with the actual connection name you're using.

  • eth0 is using DHCP. eth1 is set Static. I use NetworkManager to configure.
    – user568471
    Apr 10, 2023 at 20:19
  • it works. Thanks.
    – user568471
    Apr 12, 2023 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .