Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when changing default gateway to another interface #59

Open
pescobar opened this issue Jun 18, 2019 · 3 comments
Open

error when changing default gateway to another interface #59

pescobar opened this issue Jun 18, 2019 · 3 comments

Comments

@pescobar
Copy link
Contributor

I am trying to configure a machine that is working with gateway 10.10.10.1 (eth0) to use a different gateway (100.100.100.254) in eth1 . this is my config:

interfaces_ether_interfaces:
  - device: eth0
    bootproto: dhcp
    dnsnameservers: 10.10.10.1
  - device: eth1
    bootproto: static
    address: 100.100.100.66
    netmask: 255.255.255.0
    gateway: 100.100.100.254

When I run the role I get this error:

RUNNING HANDLER [MichaelRigart.interfaces : Check active Ethernet interface state] ****************************************************************************************************************************************************
skipping: [sosci-devel.scicore-dmz.lan] => (item={u'device': u'eth0', u'dnsnameservers': u'10.10.10.1', u'bootproto': u'dhcp', u'dnssearch': u'scicore-dmz.lan scicore.unibas.ch unibas.ch'})  => {
    "changed": false,
    "item": {
        "bootproto": "dhcp",
        "device": "eth0",
        "dnsnameservers": "10.10.10.1",
       },
    "skip_reason": "Conditional result was False"
}
failed: [sosci-devel.scicore-dmz.lan] (item={u'device': u'eth1', u'netmask': u'255.255.255.0', u'bootproto': u'static', u'gateway': u'100.100.100.254', u'address': u'100.100.100.66'}) => {
    "changed": false,
    "item": {
        "address": "100.100.100.66",
        "bootproto": "static",
        "device": "eth1",
        "gateway": "100.100.100.254",
        "netmask": "255.255.255.0"
    },
    "msg": "Default IPv4 gateway is incorrect"
}

If I rerun the role it works fine at the second try.

I could also workaround the issue by commenting out these lines

any suggestion about how to do a proper fix that could be merged upstream? I can test it and send a PR

@markgoddard
Copy link

Hi Pablo, can you check what the default route is after the first and second runs? Has the network config been applied successfully or not?

@pescobar
Copy link
Contributor Author

ups, I missed this...sorry for the late reply. I will do the requested tests tomorrow and I will reply here again

@pescobar
Copy link
Contributor Author

this is the network config with a clean installation of the machine (no ansible execution yet)

$> ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 3e:ae:97:38:7d:c9 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.17/25 brd 10.10.10.127 scope global noprefixroute dynamic eth0
       valid_lft 42695sec preferred_lft 42695sec
    inet6 fe80::3cae:97ff:fe38:7dc9/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 06:a5:b3:8f:34:fd brd ff:ff:ff:ff:ff:ff
$> ip r
default via 10.10.10.1 dev eth0 proto dhcp metric 100
10.10.10.0/25 dev eth0 proto kernel scope link src 10.10.10.17 metric 100

after the first run I get the error in RUNNING HANDLER [MichaelRigart.interfaces : Check active Ethernet interface state] and this the network status after the error:

$> ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 3e:ae:97:38:7d:c9 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.17/25 brd 10.10.10.127 scope global dynamic eth0
       valid_lft 43120sec preferred_lft 43120sec
    inet6 fe80::3cae:97ff:fe38:7dc9/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 06:a5:b3:8f:34:fd brd ff:ff:ff:ff:ff:ff
    inet 100.100.100.66/24 brd 100.100.100.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::4a5:b3ff:fe8f:34fd/64 scope link
       valid_lft forever preferred_lft forever
$> ip r
default via 10.10.10.1 dev eth0
10.10.10.0/25 dev eth0 proto kernel scope link src 10.10.10.17
100.100.100.0/24 dev eth1 proto kernel scope link src 100.100.100.66
169.254.0.0/16 dev eth0 scope link metric 1002
169.254.0.0/16 dev eth1 scope link metric 1003

and after second execution it works fine and this is the final network status:

$> ip a
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 3e:ae:97:38:7d:c9 brd ff:ff:ff:ff:ff:ff
    inet 10.10.10.17/25 brd 10.10.10.127 scope global dynamic eth0
       valid_lft 42953sec preferred_lft 42953sec
    inet6 fe80::3cae:97ff:fe38:7dc9/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 06:a5:b3:8f:34:fd brd ff:ff:ff:ff:ff:ff
    inet 100.100.100.66/24 brd 100.100.100.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::4a5:b3ff:fe8f:34fd/64 scope link
       valid_lft forever preferred_lft forever
$> ip r
default via 100.100.100.254 dev eth1
10.10.10.0/25 dev eth0 proto kernel scope link src 10.10.10.17
100.100.100.0/24 dev eth1 proto kernel scope link src 100.100.100.66
169.254.0.0/16 dev eth0 scope link metric 1002
169.254.0.0/16 dev eth1 scope link metric 1003

thanks for looking into this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants