add multicast ip address into kernel route table

11,605

I'm afraid I don't understand multicast too well, but the problem that your command has is the '-interface'. It should instead look like this:

sudo route -nv add -net 228.0.0.4 dev eth0

From the man route pages, an example:

route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
  This is an obscure one documented so people know how to  do  it.
  This  sets  all  of  the class D (multicast) IP routes to go via
  "eth0". This is the correct normal  configuration  line  with  a
  multicasting kernel.
Share:
11,605

Related videos on Youtube

macavity
Author by

macavity

Updated on September 18, 2022

Comments

  • macavity
    macavity almost 2 years

    i want to add an IP (multicast 228.0.0.4) in the range of 224.0.0.0 – 239.255.255.255 in the kernel routes table, so i used

    sudo route -nv add -net 228.0.0.4 -interface eth0
    

    but it gives me:

    root@macavity:/home/gaiz# route -nv add -net 228.0.0.4 -interface eth0
    route: invalid option -- 'i'
    route: invalid option -- 't'
    route: invalid option -- 'r'
    route: invalid option -- 'f'
    route: invalid option -- 'a'
    route: invalid option -- 'c'
    Usage: route [-nNvee] [-FC] [<AF>]           List kernel routing tables
           route [-v] [-FC] {add|del|flush} ...  Modify routing table for AF.
    
           route {-h|--help} [<AF>]              Detailed usage syntax for specified AF.
           route {-V|--version}                  Display version/author and exit.
    
            -v, --verbose            be verbose
            -n, --numeric            don't resolve names
            -e, --extend             display other/more information
            -F, --fib                display Forwarding Information Base (default)
            -C, --cache              display routing cache instead of FIB
    
      <AF>=Use '-A <af>' or '--<af>'; default: inet
      List of possible address families (which support routing):
        inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
        netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
        x25 (CCITT X.25)
    

    my route table:

    root@macavity:/home/gaiz# netstat -r
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    default         dsldevice.lan   0.0.0.0         UG        0 0          0 wlan0
    192.168.1.0     *               255.255.255.0   U         0 0          0 wlan0
    

    and my current network configuration information

    root@macavity:/home/gaiz# ifconfig -a
    
        eth0      Link encap:Ethernet  HWaddr 24:b6:fd:4a:15:ca  
                  inet6 addr: fe80::26b6:fdff:fe4a:15ca/64 Scope:Link
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:268 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:107 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000 
                  RX bytes:16136 (16.1 KB)  TX bytes:15102 (15.1 KB)
    
        lo        Link encap:Local Loopback  
                  inet addr:127.0.0.1  Mask:255.0.0.0
                  inet6 addr: ::1/128 Scope:Host
                  UP LOOPBACK RUNNING  MTU:65536  Metric:1
                  RX packets:2444 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:2444 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:0 
                  RX bytes:393755 (393.7 KB)  TX bytes:393755 (393.7 KB)
    
        wlan0     Link encap:Ethernet  HWaddr e0:06:e6:79:60:49  
                  inet addr:192.168.1.64  Bcast:192.168.1.255  Mask:255.255.255.0
                  inet6 addr: fe80::e206:e6ff:fe79:6049/64 Scope:Link
                  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                  RX packets:92082 errors:0 dropped:0 overruns:0 frame:0
                  TX packets:63686 errors:0 dropped:0 overruns:0 carrier:0
                  collisions:0 txqueuelen:1000 
                  RX bytes:112279263 (112.2 MB)  TX bytes:8760358 (8.7 MB)
    
  • macavity
    macavity almost 10 years
    now it says invalid argument root@macavity:/home/gaiz# sudo route -nv add -net 228.0.0.4 dev eth0 SIOCADDRT: Invalid argument
  • Charles Green
    Charles Green almost 10 years
    @macavity Modifying answer