On Thu, Jul 11, 2002 at 09:24:41AM -0500, default wrote: > I need to add a new subnet and router interface to my FreeBSD machine (one > nic) and a new router interface to access the subnet. I know that there is > some sort of problem with adding aliases that makes it so one must enter > 255.255.255.255 as the subnet mask for I.P. addresses other than the main > one. What I was wondering is how do get around this to add another subnet, > and how do I add the new router interface?
Yes --- this point seems to cause some confusion. The netmask that you supply when ifconfig'ing alias interface will be 255.255.255.255 in some circumstances or eg. 255.255.255.0 (whatever the appropriate netmask for the network is) in other cases. The distinction is between the second (and subsequent) addresses on a subnet, and addresses on different subnets. An example would probably clarify things. Let's suppose that you have two networks: 172.72.0.0/16 192.168.68.0/24 and that you need your machine to use the IP numbers 172.72.0.99, 172.72.27.27, 192.168.68.1 and 192.168.68.8, all on interface fxp0. To configure this little lot, you would issue ifconfig commands as follows: ifconfig fxp0 inet 172.72.0.99 netmask 255.255.0.0 (1) ifconfig fxp0 inet 172.72.27.27 netmask 255.255.255.255 alias (2) ifconfig fxp0 inet 192.168.68.1 netmask 255.255.255.0 alias (3) ifconfig fxp0 inet 192.168.68.8 netmask 255.255.255.255 alias (4) or the equivalent in /etc/rc.conf: ifconfig_fxp0="inet 172.72.0.99 netmask 255.255.0.0" ifconfig_fxp0_alias0="inet 172.72.27.27 netmask 255.255.255.255" ifconfig_fxp0_alias1="inet 192.168.68.1 netmask 255.255.255.0" ifconfig_fxp0_alias2="inet 192.168.68.8 netmask 255.255.255.255" (1) sets up the principal address on the interface -- it doesn't matter which address out of the four is chosen, as any of them would work well enough. This is the source address the box will use for itself when making connections on that network. (2) adds another interface on the 172.72.0.0/17 network. This one gets the "all ones" netmask, as it's the second interface on the same subnet. Packets will only be sent out with this as a source address in response to a connection there. (3) adds an alias on a different subnet. It's the first address added from that subnet, so it gets the netmask appropriate for that subnet. This will be the default address the box uses on the 192.168.68.0/24 network. (4) is the second address added on the 192.168.68.0/24 network, so it gets the 255.255.255.255 netmask. Given this setup, and assuming there are no complicating factors such as the use of jail(8), if you telnet from the box to 172.72.56.1, then 172.72.0.99 will be used as the source address of the packets sent. Similarly, telnet to 192.168.68.68 will use a source address of 192.168.68.1 Conversely, telnet from 172.72.56.1 to 172.72.27.27 will elicit response packets from 172.72.27.27 as expected. Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way Tel: +44 1628 476614 Marlow Fax: +44 0870 0522645 Bucks., SL7 1TH UK To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-questions" in the body of the message