-1

I am assigning static IP address on a Linux module 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.

what to do? 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

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
James Z
  • 12,209
  • 10
  • 24
  • 44
  • `on a Linux module` what "linux module"? These are deprecated commands. What is the output of `ip a` and `ip r`? – KamilCuk Aug 25 '23 at 10:30
  • This is custom yocto distribution on a custom hardware with TI AM3359 processor using SysVinit. I have also tried the same IP assigning using /etc/network/interfaces file but the same behaviour is there. Also, edited the output of ip a and ip r – Aditya Kumawat Aug 25 '23 at 10:39

0 Answers0