Before I start, please, without solutions which consider using external web services which show you your public IP!
Solution must be resolved by FreeBSD LAN client (i.e; 192.168.0.*) using command line tools as ping/traceroute/etc.
When its IP packet destination has a public IP, it passes through a router (ISP's embedded) which does NAT and sends it to the internet.
At that moment, when it passes through router's NIC with public IP, I want to get router's public IP.
Routers LAN private ip is a 192.168.0.1
Where 0.0.0.0 is, I expected public WAN's IP.
But when I target public WAN's IP directly it is just 1 hop away.
Solution must be resolved by FreeBSD LAN client (i.e; 192.168.0.*) using command line tools as ping/traceroute/etc.
When its IP packet destination has a public IP, it passes through a router (ISP's embedded) which does NAT and sends it to the internet.
At that moment, when it passes through router's NIC with public IP, I want to get router's public IP.
Routers LAN private ip is a 192.168.0.1
Code:
# traceroute -nI $pub_ip
1 192.168.0.1 63.351 ms 9.950 ms 20.352 ms
2 0.0.0.0 29.347 ms 17.720 ms 140.800 ms
3 $pub_ip 177.774 ms 243.006 ms 145.638 ms
But when I target public WAN's IP directly it is just 1 hop away.
Code:
# traceroute -nI $wan_ip
1 $wan_ip 172.432 ms 92.916 ms 208.902 ms