2

I'm having a hard time creating a network interface without a static route being generated to use the default gw. More specifically, I'm trying to create a VLAN interface using the following ifcfg script file in centos 6

DEVICE=eth0.123
VLAN=yes
BOOTPROTO=static
IPADDR=172.16.0.1
NETMASK=255.240.0.0
ONBOOT=yes
IPV6INIT=no
TYPE=Ethernet

when I bring up the interface though, I end up with the following routes in my routing table

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.64.20.1      0.0.0.0         UG    0      0        0 eth0
10.64.20.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1003   0        0 eth0.123
169.254.0.0     0.0.0.0         255.255.0.0     U     1113   0        0 eth0
172.16.0.0      0.0.0.0         255.240.0.0     U     0      0        0 eth0.123

For my particular needs, I don't want the route for the 172.16.0.0 network to be generated because I am adding another route to go through vpn tunnel server. Everything works if I remove the 172.16.0.0 network route manually. However it's not persistent and I would like it to be.

Any help would be appreciated.

Thanks

  • 3
    That route is a local route, and is there because you added an interface with an IP in that network, and it's telling you that eth0.123 is the interface you use to get to that network. Remove the IP address from the VLAN interface, and you won't have that route, or change IP schemes on that VLAN interface to not overlap with your other route. – Tim Kennedy Mar 15 '17 at 1:22
0

add following to ifcfg config file

DEFROUTE=no

It will not create default route for this interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.