multiple vlans 1 interface question

Issues related to configuring your network
Post Reply
vivithemage
Posts: 34
Joined: 2009/03/06 17:31:14
Contact:

multiple vlans 1 interface question

Post by vivithemage » 2017/07/29 18:58:26

Hi,

I am trying to bind 7 /24 VLAN's to an interface. This is what my eth0 looks like and one of my /24's.

Code: Select all

root@localhost network-scripts]# cat ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
[root@localhost network-scripts]# cat ifcfg-eth0.9
DEVICE=eth0.9
BOOTPROTO=none
HWADDR=00:19:xx:xx:xx:xx
ONBOOT=yes
TYPE=Ethernet
IPADDR=173.xx.xx.2
NETMASK=255.255.255.0
VLAN=yes
[root@localhost network-scripts]# cat ifcfg-eth0.9-range0
IPADDR_START=173.xx.xx.3
IPADDR_END=173.xx.xx.254
NETMASK=255.255.255.0
CLONENUM_START=10
and a second /24:

Code: Select all

[root@localhost network-scripts]# cat ifcfg-eth0.29
DEVICE=eth0.29
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=192.xx.xx.2
NETMASK=255.255.255.0
VLAN=yes
[root@localhost network-scripts]# cat ifcfg-eth0.29-range0
IPADDR_START=192.xx.xx.3
IPADDR_END=192.xx.xx.254
NETMASK=255.255.255.0
CLONENUM_START=274
Then I have their respective rule and routes:

Code: Select all

[root@localhost network-scripts]# cat rule-eth0.9
from 173.xx.xx.0/24 table 1
[root@localhost network-scripts]# cat route-eth0.9
default via 173.xx.xx.1 dev eth0.9 table 1
[root@localhost network-scripts]# cat route-eth0.29
default via 192.xx.xx.1 dev eth0.29 table 2
[root@localhost network-scripts]# cat rule-eth0.29
from 192.xx.xx.0/24 table 2
[root@localhost network-scripts]#
and then the other 5 /24's follow suite. Any ideas why I can get to the ip addresses, but I cannot get out of the box?

Code: Select all

[root@localhost network-scripts]# ping 4.2.2.2
connect: Network is unreachable
[root@localhost network-scripts]#
but I can SSH to the box on the internet. I am new to iproute2, but wouldn't there be a default gateway?

Code: Select all

[root@localhost network-scripts]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.xx.xx.0   *               255.255.255.0   U         0 0          0 eth0.12
173.xx.xx.0   *               255.255.255.0   U         0 0          0 eth0.9
198.xx.xx.0     *               255.255.255.0   U         0 0          0 eth0.14
198.xx.xx.0     *               255.255.255.0   U         0 0          0 eth0.15
192.xx.xx.0   *               255.255.255.0   U         0 0          0 eth0.19
199.xx.xx.0     *               255.255.255.0   U         0 0          0 eth0.11
192.xx.xx.0   *               255.255.255.0   U         0 0          0 eth0.29
link-local      *               255.255.0.0     U         0 0          0 eth0
link-local      *               255.255.0.0     U         0 0          0 eth0.11
link-local      *               255.255.0.0     U         0 0          0 eth0.12
link-local      *               255.255.0.0     U         0 0          0 eth0.14
link-local      *               255.255.0.0     U         0 0          0 eth0.15
link-local      *               255.255.0.0     U         0 0          0 eth0.19
link-local      *               255.255.0.0     U         0 0          0 eth0.29
link-local      *               255.255.0.0     U         0 0          0 eth0.9
[root@localhost network-scripts]#

User avatar
jlehtone
Posts: 2382
Joined: 2007/12/11 08:17:33
Location: Finland

Re: multiple vlans 1 interface question

Post by jlehtone » 2017/07/29 21:56:47

There can be only one ... default route.

What are all those ranges?

Why separate routing tables?

At the other end of that trunk wire is a device that has those same 7 LANs?

How would you set the configuration, if your machine would have 7 NICs; one for each LAN?

Only the 192.xx.xx/24 subnets are private. Other are public ranges. Obfuscation?


PS. I like the output of

Code: Select all

ip ro show
ip ro show table 1
ip ro show table 2

vivithemage
Posts: 34
Joined: 2009/03/06 17:31:14
Contact:

Re: multiple vlans 1 interface question

Post by vivithemage » 2017/07/30 02:09:51

They're actually not private 192's...I guess I don't see any harm in including the full range:

Code: Select all

[root@localhost network-scripts]# ip ro show
192.119.173.0/24 dev eth0.12  proto kernel  scope link  src 192.119.173.2
173.243.116.0/24 dev eth0.9  proto kernel  scope link  src 173.243.116.2
198.50.30.0/24 dev eth0.14  proto kernel  scope link  src 198.50.30.2
198.50.31.0/24 dev eth0.15  proto kernel  scope link  src 198.50.31.2
192.119.168.0/24 dev eth0.19  proto kernel  scope link  src 192.119.168.2
199.96.80.0/24 dev eth0.11  proto kernel  scope link  src 199.96.80.2
192.119.166.0/24 dev eth0.29  proto kernel  scope link  src 192.119.166.2
169.254.0.0/16 dev eth0  scope link  metric 1002
169.254.0.0/16 dev eth0.11  scope link  metric 1004
169.254.0.0/16 dev eth0.12  scope link  metric 1005
169.254.0.0/16 dev eth0.14  scope link  metric 1006
169.254.0.0/16 dev eth0.15  scope link  metric 1007
169.254.0.0/16 dev eth0.19  scope link  metric 1008
169.254.0.0/16 dev eth0.29  scope link  metric 1009
169.254.0.0/16 dev eth0.9  scope link  metric 1010
[root@localhost network-scripts]#

Code: Select all

[root@localhost network-scripts]# ip ro show table 1
default via 173.243.116.1 dev eth0.9
[root@localhost network-scripts]#

Code: Select all

[root@localhost network-scripts]# ip ro show table 2
default via 192.119.166.1 dev eth0.29
[root@localhost network-scripts]#

The only reason I am doing it this way is, this is how I remember doing it before for a bunch of vlan's. All of them are pingable/sshable externally, I am just having a hard time remembering what I had to do to route traffic out via default gateway.

vivithemage
Posts: 34
Joined: 2009/03/06 17:31:14
Contact:

Re: multiple vlans 1 interface question

Post by vivithemage » 2017/07/30 17:27:34

I ended up resolving it, I ran:

ip route add default via 173.243.116.1 dev eth0.9

I kind of figured it was something simple. For my knowledge though, why is that needed when I had all of those default routes added as part of my config in the first place?

Post Reply

Return to “CentOS 6 - Networking Support”