Ubuntu – How to get gateway of network interface

iptablesnetworkingvpn

Playing around with VPN connections on SoftEther, I created a virtual network interface for the VPN. Now in order to set iptables to route via this network interace, I need the gateway of the VPN server (local ip of the host). Is there an easy way to get it? I tried ip neigh but this does not list my virtual network interface.

Best Answer

  • Try ip r. It will show info in the form

    default via aa.bb.cc.dd ...
    
  • or netstat -r -

    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    
  • traceroute goo.gl or tracepath goo.gl will show all routers (VPN-gateway at the top)

Related Question