Home > linux > ifconfig fails to install route if interface ip is existing broadcast address

ifconfig fails to install route if interface ip is existing broadcast address

March 9Hits:1
Advertisement

Consider the following setup:

[email protected]:~$ sudo ip link add link eth0 name eth0.3 type vlan id 3 [email protected]:~$ sudo ip link add link eth0 name eth0.2 type vlan id 2 [email protected]:~$ sudo ifconfig eth0.2 192.168.2.1/30 [email protected]:~$ sudo ifconfig eth0.3 192.168.2.2/29 [email protected]:~$ route -n Kernel IP routing table Destination     Gateway         Genmask         Flags Metric Ref    Use Iface ... 192.168.2.0     0.0.0.0         255.255.255.252 U     0      0        0 eth0.2 192.168.2.0     0.0.0.0         255.255.255.248 U     0      0        0 eth0.3 

As you can see, while they have overlapping subnets, both routes for eth0.2 and eth0.3 get installed. However, when I try this:

[email protected]:~$ sudo ifconfig eth0.3 192.168.2.3/29 [email protected]:~$ route -n Kernel IP routing table Destination     Gateway         Genmask         Flags Metric Ref    Use Iface ... 192.168.2.0     0.0.0.0         255.255.255.252 U     0      0        0 eth0.2 

You can see that the route for eth0.3 is not there. What is the major difference? The configured eth0.3 ip is the broadcast address of the subnet configured on eth0.2. Okay, yes this is messed up, but the interface comes online, the only thing that does not happen is adding the route to the route table. And actually, the route table doesn't even care about that broadcast address:

[email protected]:~$ sudo route add -net 192.168.2.0/29 dev eth0.3 [email protected]:~$ route -n Kernel IP routing table Destination     Gateway         Genmask         Flags Metric Ref    Use Iface ... 192.168.2.0     0.0.0.0         255.255.255.252 U     0      0        0 eth0.2 192.168.2.0     0.0.0.0         255.255.255.248 U     0      0        0 eth0.3 [email protected]:~$ sudo ip link del eth0.3 [email protected]:~$ sudo ip link del eth0.2 

Is there any way to get around this? Before you state that I found it out myself by adding the route afterwards: in my setup the actual ifconfig happens through a dhclient script that I cannot edit, so doing that route add would require hooking the dhclient, reading back the IP from somewhere and executing the route add which is quite tedious. I was hoping I could change this behaviour with some flags on the interface?

P.S. This is of course not a real network design, but is required for a testing setup.

Answers

A active /30 route will always be preferred over any /29 route. So unless you had a /32 host route for 192.168.2.2 in place, the routing table would still send traffic to 192.168.2.2 to the /30 interface.

Its unclear if the 192.168.2.3 interface was ever installed, as the .3 is the broadcast for 192.168.2.0/30, and a packet sent to 192.168.2.3 has a special function: to be sent to all hosts on 192.168.2.0/30, not to be unicast to a less specific network on another interface.

If instead of a /30 and a /29, you were working with a /29 and a /28, you would be having a problem with the .7.

Related Articles

  • ifconfig fails to install route if interface ip is existing broadcast addressMarch 9

    Consider the following setup: [email protected]:~$ sudo ip link add link eth0 name eth0.3 type vlan id 3 [email protected]:~$ sudo ip link add link eth0 name eth0.2 type vlan id 2 [email protected]:~$ sudo ifconfig eth0.2 192.168.2.1/30 [email protected]:~$ sudo ifconfig eth0.3 192.168.2.2/29 [email protected]:~$ route

  • Installing router - failed to verify router settingsOctober 6

    I'm trying to install a TP-Link wireless router. I am using a modem an have a PPPoE connection. I connected the router to the computer and the modem, but in the last step of the Easy Setup it says " Failed to verify router settings. 1. Please check t

  • GnuPG::Interface fails to install on CentOS 7January 28

    I'm trying to install a CentOS 7 server to run Request Tracker. By running make testdeps I can see all missing packages and make fixdeps is supposed to install this packages. There is one package that I can't install (GnuPG::Interface). This package

  • nmap failed to determine routeJuly 10

    I have set about trying to learn nmap, though for some reason it does not work I keep getting the same error, the only time it works is when I specify loopback address, this is the error I get otherwise: Premature EOF in /proc/net/route nexthost: fai

  • Two instances of Windows Vista on boot up after failed clean installJune 29

    I tried to install a clean version of Vista but failed. I ended up with Windows and Windows.old on my C: drive and a dual boot option on boot up. I gave up and booted up the old version and tried to rename the Windows.old to Windows and was asked if

  • cisco router 1814 interface activation with single IP routing

    cisco router 1814 interface activation with single IP routingSeptember 12

    i have this simple diagram below: I need to make 192.168.55.1 talk with 10.0.2.59 by open the interface 0/1 [192.168.56.254] by talk mean what is router commands required to open new interface and make the ip route ONLY route the 2 endpoints? let me

  • Ubuntu 12.04 Bootloader failed to installJuly 29

    Sorry about the excessively long question, but I figured giving more information would be better. I recently bought a new desktop for myself, running Windows 7. It has two hard drives, and I wanted to install Ubuntu on a small partition on the second

  • UEFI: Failed to install override security policyJuly 3

    I run the latest Arch Linux image on ASUS Sabertooth 990FX and get this error. Failed to install override security policy. How can i fix it? --------------Solutions------------- I ran into the same error on an Asus UX21E machine. The latest BIOS (v 2

  • VirtualBox Network Adapter fails to install

    VirtualBox Network Adapter fails to installDecember 23

    The Host-Only Adapter fails to install in Windows 8.1 x64 with VirtualBox-4.3.20-96997. When VirtualBox is installed, Host-Only appears in the Device Manager as a failed device. Therefore Host-Only is not visible in the Network Connections window. Re

  • Windows XP static route to LAN, default route to loopback or non-existent interface

    Windows XP static route to LAN, default route to loopback or non-existent interfaceJune 17

    I have an XP standalone workstation that I want to really lock down so it can't get online outside of the LAN, even if the user knows a site's IP address. My LAN has addresses of 10.10.0.0/16 and 166.100.100.0/24. route add 10.10.0.0 mask 255.255.0.0

  • Why does Chocolatey fail to install Elixir on Windows?

    Why does Chocolatey fail to install Elixir on Windows?December 18

    I'm a wizard at Linux/Unix-based OSes, but I'm rubbish at Windows and the like. To be able to install package via a CLI, which I prefer to graphical installers, I installed Chocolatey onto my Windows XP SP3 system. Wishing to install the Elixir progr

  • igraph Failed to install through pip

    igraph Failed to install through pipJanuary 23

    Igraph failed to install through pip install python-igraph --------------Solutions------------- This is a bug with igraph's setup.py on Windows. Theoretically you could work around this by downloading the source code of python-igraph from PyPI, extra

  • Microsoft Office updates fail to installApril 30

    I have one computer (Windows XP) which is updating via update services. Most updates are installing successfully, however updates to MS Office are failing to install. Windows updates then pops up again with the list of pending office updates still li

  • CPAN fails to install DateTime moduleAugust 14

    I tried to install the Perl DateTime module by running "cpan" and typing "install DateTime" at the prompt. After a lot of processing and printing I got this message: Compilation failed in require at (eval 907) line 3. # Looks like your

  • winexe gives error "ERROR: Failed to install service winexesvc - NT_STATUS_ACCESS_DENIED"October 7

    I'm trying to do a remote execution on a windows host from Linux with winexe. I get the error: ERROR: Failed to install service winexesvc - NT_STATUS_ACCESS_DENIED The authenticated user should have administrator rights. What exactly does this error

  • How to fix: Western Digital My Book 500GB - fail to install drivers, is not accessibleJanuary 20

    The WD-My Book 500GB is recognized as a local disc in my system(Windows 7), but it's drivers fail to install successfully when connected via USB cable with computer. Then when I try to open it(explore), it slows down the PC, and after some minutes it

  • access router web interface from outside (have ssh access to machine inside)August 4

    I'm trying to access my router web interface remotely, but I don't have access to the router for another few months (traveling). internally, my ubuntu server's IP is [192.168.1.111]. My router IP is [192.168.1.1] let's say the domain name example.com

  • How to learn current ACLs on a Cisco router's interfaceAugust 28

    I want to add new ACL rules to a Cisco router. I have no previous experience with cisco. Many resources about Cisco acls have instructions on applying the acl rules to an interface. But I need to know which ACL rule is already active in an interface,

  • Grub always fails to install, furthest I get is grub promptOctober 11

    Tried to install 10.10 yesterday and eventually got an error that Grub had failed to install. Asked me to select another partition, cancel install or continue without a bootloader. Everytime I selected another partition the error would just pop back

  • Repartitioned my Drive and now the Ubuntu LiveCD installer always fails to install grub!October 16

    OK. I installed Ubuntu 10.04 a week or so ago over an old Ubuntu partition - no problem. Grub went on fine (it had previously been overwritten by windows). Then, after remembering how much I like Ubuntu and using a terminal I thought I'd upgrade to 1

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.685 s.