Linux Netfilter discussions
 help / color / mirror / Atom feed
* Cannot route through an if without ip
@ 2006-05-14  8:09 antonio.dibacco
  2006-05-14 10:04 ` Alexandru Dragoi
  2006-05-14 12:00 ` Pascal Hambourg
  0 siblings, 2 replies; 3+ messages in thread
From: antonio.dibacco @ 2006-05-14  8:09 UTC (permalink / raw)
  To: netfilter


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 

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

Why? 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cannot route through an if without ip
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandru Dragoi @ 2006-05-14 10:04 UTC (permalink / raw)
  To: antonio.dibacco; +Cc: netfilter

antonio.dibacco wrote:

>
> 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
> If the same IF has an address the command will be correctly executed.
> Why?
>
You can't do that. If you know the mac of the other router, do domething
like:

#ip ro add 172.20.20.20/32 dev eth1 scope link
#arp -s 172.20.20.20 <mac>
#ip ro add 192.168.1.0/24 via 172.20.20.20.20

So .. this just show why you can't just route throught an ethernet
device, unless you "want" to do some multicast flood.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Cannot route through an if without ip
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Pascal Hambourg @ 2006-05-14 12:00 UTC (permalink / raw)
  To: netfilter

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 ?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-05-14 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox