Try DigitalOcean free for up to two months!

UDP listen on the secondary interface

Discussion in 'Linux Networking' started by John Doe, Mar 15, 2017.

  1. John Doe

    John Doe New Member

    Joined:
    Mar 15, 2017
    Messages:
    2
    Likes Received:
    0
    Hi,
    I want to listen to UDP packets on the secondary interface (my own program, but this is reproducible with netcat as well).
    I have an ubuntu 16.04.02 LTS system, with 2 different network interfaces:
    1. ethernet - 10.x.x.x
    2. wifi - 192.168.x.x
    The routing table is the default one:
    Code:
    user@ubuntu-ws:/tmp$ route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    default         10.x.x.x        0.0.0.0         UG    0      0        0 eth0
    default         OpenWrt.lan     0.0.0.0         UG    600    0        0 wlan0
    10.x.0.0        *               255.255.0.0     U     100    0        0 eth0
    link-local      *               255.255.0.0     U     1000   0        0 eth0
    192.168.x.0     *               255.255.255.0   U     600    0        0 wlan0

    Neither netcat -4 -u -l 0.0.0.0 12345, nor netcat -4 -u -l 192.168.x.x 12345 doesn't seems to receive any packet although I can see UDP packets on the wlan0 interface on port 12345.
    Code:
    user@ubuntu-ws:/$ sudo netstat -upln | egrep -i '12345|proto'
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    udp        0      0 0.0.0.0:12345           0.0.0.0:*                           15697/netcat   
    
    Any hints are highly appreciated.
    Thanks!
     
  2. John Doe

    John Doe New Member

    Joined:
    Mar 15, 2017
    Messages:
    2
    Likes Received:
    0
    Adding a new routing table solved my problem. This article helped me: "thomas-krenn com/en/wiki/Two_Default_Gateways_on_One_System"
     

Share This Page