Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: Cannot route through an if without ip
Date: Sun, 14 May 2006 14:00:42 +0200	[thread overview]
Message-ID: <44671BEA.5020008@plouf.fr.eu.org> (raw)
In-Reply-To: <20060514080905.18403.qmail@mx1.aruba.it>

Hello,

antonio.dibacco a écrit :
> 
> I have an ethernet (eth1) without any assigned ip, nevertheless I would 
> like to route through this IF but issueing the following command gives 
> an error:
> route add -net 192.168.1.0 dev eth1

When I type this command I get an error because 192.168.1.0 is not a 
subnet, I must add a mask or prefix length, for instance :

route add -net 192.168.1.0/24 dev eth1

> If the same IF has an address the command will be correctly executed.
> Why?

The interface has to be up and bound to IPv4. You can check this when 
directory /proc/sys/net/ipv4/conf/eth1 exists. To force this without 
assigning an address to the interface, just execute the following command :

ifconfig eth1 0.0.0.0 up

The default source address used in locally generated packets will be 
chosen among addresses assigned to other interfaces. You can assign it 
statically creating the route with 'ip' instead of 'route' :

ip route add 192.168.1.0/24 dev eth1 src $LOCAL_IP

where $LOCAL_IP is a local address assigned to any interface but the 
loopback.

Note there are possible issues regarding routing and ARP if you expect 
to receive IPv4 traffic on eth1.
- Routing : hosts on the network reachable on eth1 must have appropriate 
route(s) to the box addresse(s).
- ARP : your box must accept and reply to ARP requests about any local 
address received on eth1. For this, make sure the kernel parameters 
arp_filter, arp_announce and arp_ignore in /proc/sys/net/ipv4/conf/eth1 
have appropriate value (default values 0 should be fine). Or you can add 
static ARP entries on the hosts reachable on eth1.

PS: Any feedback about my reply to your previous question ?


      parent reply	other threads:[~2006-05-14 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-14  8:09 Cannot route through an if without ip antonio.dibacco
2006-05-14 10:04 ` Alexandru Dragoi
2006-05-14 12:00 ` Pascal Hambourg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44671BEA.5020008@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox