Score:1

A gateway of 0.0.0.0 gets added in my linux machine after I assign a static IP and static gateway

bm flag

I am assigning static IP address on a Linux module (custom Yocto Distribution on TI AM3359 custom hardware) using the ifconfig command.

sudo ifconfig eth1 10.11.3.80 netmask 255.255.248.0

sudo route add default gw 10.11.0.1 eth1

If I do this before around 60 seconds of time, the routing table looks like this and I am able to ping the module from a dynamic IP of range 172.10.xx.xx indefinitely.

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.11.0.1       0.0.0.0         UG    0      0        0 eth1
10.11.0.0       0.0.0.0         255.255.248.0   U     0      0        0 eth1

But if I assign a static IP instantly after power up, my routing table changes to this after a delay which is around a minute or so.

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 eth1
0.0.0.0         10.11.0.1       0.0.0.0         UG    0      0        0 eth1
10.11.0.0       0.0.0.0         255.255.248.0   U     0      0        0 eth1
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1

After this scenario happens, I am unable to ping the board from a dynamic IP address.

Please suggest what to do as I have explored almost all of the internet for a solution yet haven't found anything at all.

My firewall looks like this:

root@a:~# iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT

And this is the output of ip addr:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,PROMISC,DYNAMIC,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 3c:e0:64:14:b3:c9 brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,PROMISC,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3c:e0:64:14:b3:cb brd ff:ff:ff:ff:ff:ff
    inet 10.11.3.80/21 brd 10.11.7.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet 169.254.199.165/16 brd 169.254.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::3ee0:64ff:fe14:b3cb/64 scope link
       valid_lft forever preferred_lft forever

Mind that if I try to ping the module from a similar IP range e.g., of range 10.xx.x.xx, it works.

I tried disabling zeroconf, my firewall and tried disabling dhcp. But none of them seemed to work.

EDIT:

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,PROMISC,DYNAMIC,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 3c:e0:64:14:b3:c9 brd ff:ff:ff:ff:ff:ff
4: eth1: <BROADCAST,MULTICAST,PROMISC,DYNAMIC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 3c:e0:64:14:b3:cb brd ff:ff:ff:ff:ff:ff
    inet 10.11.3.80/21 brd 10.11.7.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet 169.254.199.165/16 brd 169.254.255.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::3ee0:64ff:fe14:b3cb/64 scope link
       valid_lft forever preferred_lft forever

ip r

default dev eth1 scope link
default via 10.11.0.1 dev eth1
10.11.0.0/21 dev eth1 proto kernel scope link src 10.11.3.80
169.254.0.0/16 dev eth1 proto kernel scope link src 169.254.199.165
Hack Saw avatar
tz flag
I know little of yocto, but a common configuration for networking is to use the /sbin/ifup command, which reads configuration files somewhere in /etc (such as /etc/networks) and sets up networks from that. This is a better method than running things by hand. It happens during boot, under the root permissions, and before anything else happens, typically.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.