Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2001 23:14:40 +0200
From:      universe <universe@truemetal.org>
To:        freebsd-questions@freebsd.org
Subject:   assigning gateway w/ limited subnet mask.
Message-ID:  <3BA27340.CA56BE42@truemetal.org>

next in thread | raw e-mail | index | archive | help
hi all,

i have posted this message before in the freebsd and networking-in-
general newsgroups, but no one was able to supply a satisfying 
answer yet.

a not too simple (?) routing question, where freebsd doesn't act
the way i want it to, but linux surprisingly does. how odd is that.

let's assume we own 192.168.0.0/24. the gateway is 192.168.0.1.

the goal is to assign a SINGLE ip address to a freebsd box with a
according netmask (255.255.255.255). the aim is

a) to force all traffic for other machines in the /24 network to be
routed over the gateway

b) to renounce using 255.255.255.0 as the (proper) subnet mask for
customer machines, so that the customer will not realize what size 
of network he is actually in. also makes it more comfortable to 
assign SINGLE random ip addresses later (192.168.0.132/32, 
192.168.0.43/32 and so on).

(i confess b) does not really matter, so a) has priority)

now on to the problem:

i assign 192.168.0.3, netmask 255.255.255.255, broadcast 192.168.0.3
to my ethernet inferface ed0. next i try to add a host route to
192.168.0.1 by typing

route add -host 192.168.0.1 0.0.0.0 255.255.255.255

and i get back:
route: writing to routing socket: Network is unreachable
add host 192.168.0.1: gateway 0.0.0.0: Network is unreachable

makes perfect sense, the box cannot contact 192.168.0.1 because of
the limited subnet mask that i assigned, so it won't add the route.
however, i have seen this setup working on a linux box before:

linux:~ # netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window 
irtt Iface
195.88.1.1      0.0.0.0         255.255.255.255 UH        0 0         
0 eth0
62.152.1.128    0.0.0.0         255.255.255.128 U         0 0         
0 eth0
0.0.0.0         195.88.1.1      0.0.0.0         UG        0 0         
0 eth0

and, the amazing about that setup is: the linux box doesn't even need
to have a ip from the 195.88.1.0/24 network assigned. it just has the
arp address for 195.88.1.1 for some odd reason which i cannot
understand (how the heck does that work when the box doesn't have a ip
from the same subnet and therefore cannot send broadcast arp-whohas?!)
is proxy-arp in the game here?

now, my two questions are: 

1. why does the linux example actually work? where does the box get
the arp address for 195.88.1.1 from. it doesn't have a ip from the
195.88.1.0/24 network, it just has one from 62.152.1.128/25 network.

2. how do i accomplish this (assigning a single ip/32 with a gateway
from another subnet by adding a host route) under freebsd?

thanks a bunch,
markus

-- 

there's the microsoft way, there's the linux way, and there's
the right way.

-- freebsd, the winner's choice. http://www.freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3BA27340.CA56BE42>