Summary
You should check the scope of IP address of your network interface. If it is link
, the source IP addresses of your non-local outgoing packets will be substituted with 0.0.0.0
. If it is global
, you will get into the Internet as usual.
The IP address scope can be found in the ip address show
command output, in the section of your network interface.
To change the scope, you can use ip address del
to delete the IP address of your host, and then use ip address add
to re-add it with the right scope. If you do that, the default gateway would be removed from the routing table. So then you should add it manually.
That's all. After the steps listed above the Internet should work.
Example
Here is an example (some unrelevant output is truncated, some other is (un)indented):
# ip addr
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:d1:09:56 brd ff:ff:ff:ff:ff:ff
inet 169.254.55.3/16 brd 169.254.255.255 scope link dynamic ens33
valid_lft 1596sec preferred_lft 1596sec
# ip addr del 169.254.55.3/16 dev ens33
# ip addr add 169.254.55.3/16 dev ens33 scope global
# ip addr
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:d1:09:56 brd ff:ff:ff:ff:ff:ff
inet 169.254.55.3/16 scope global ens33
valid_lft forever preferred_lft forever
# ip route add default via 169.254.0.34 dev ens33
# ip route
default via 169.254.0.34 dev ens33
169.254.0.0/16 dev ens33 proto kernel scope link src 169.254.55.3
Tested on Fedora 23 and Centos 7.2 Live CDs.
Notes
- This solution has a major drawback in using static address. It does not fit well with hostel's LANs and DHCP..
- I am pretty sure that there is one simple configuration line somewhere to instruct the system to give scope global to link-local addresses (169.254.0.0/16). But I haven't found it yet. Let me know, please, if you do.
- Note that some old and just mature distros don't have this issue. For instance, Fedora 12 and new Centos 6.8 (all of them have old kernel 2.6.32) give scope global to link-local addresses.
- If one changed scope to link with those distors, he'd run into the issue discussed: the source IP addresses of all the non-local outgoing IP packets would be replaced by
0.0.0.0
.
- It's interesting to know, what makes this replace. If I knew this, I'd find the answer to the item 2.
- With scope global, non-local outgoing IP packets are routed perfectly by the NAT router built in the recent VMWare Workstation and by a Linux machine with Fedora 12 working as a router, despite of RFCs.
Confirm that your linux client is set up for ZeroConfNetworking (AVAHI) https://wiki.ubuntu.com/ZeroConfNetworking . This is how linux systems participate in zero-conf networks. Windows just uses a default fallback IP configuration that is triggered for a DHCP-configured interface that cannot retrieve a DHCP address.
– Frank Thomas – 2016-04-26T14:11:48.0502@FrankThomas There's no way to justify sending frames from 0.0.0.0 (other than BOOTP/DHCP traffic). Surely the Linux IP stack knows how to follow the IPv4 Link-Local RFC just like any other decent OS since the mid-1990's. – Spiff – 2016-04-26T19:24:48.580
Zero-conf networking (defined in RFC 3927) does in fact use broadcasts for discovery, but that doesn't seem to jive with what you are saying about IP broadcast traffic, so I'm likely misunderstanding. AVAHI is the zero-conf implementation for many/most modern linuxes. https://en.wikipedia.org/wiki/Avahi_%28software%29 https://en.wikipedia.org/wiki/Zeroconf#support
– Frank Thomas – 2016-04-27T12:19:11.610