Date: Wed, 15 Nov 2006 08:11:27 -0500 From: Jerry McAllister <jerrymc@msu.edu> To: questions@freebsd.org Subject: Re: [OT]two networks, one nic Message-ID: <20061115131127.GD11243@gizmo.acns.msu.edu>
next in thread | raw e-mail | index | archive | help
Hmmm, On Tue, Nov 14, 2006 at 06:22:30PM -0800, jekillen wrote: > > On Nov 14, 2006, at 7:43 AM, Jerry McAllister wrote: > > >On Mon, Nov 13, 2006 at 09:52:32PM -0800, jekillen wrote: > > > >>Hello FreeBSD users, > >>I have been operating under the assumption that > >>the same network interface card cannot handle two > >>different networks. But then I seem to have seen > >>an example in one of the OReill? books on networking > >>that had one interface with one assigned inet address > >>and also aliased with another address that could only > >>be on another network. If I understood that right, it > >>seems to imply that I can use one Network interface > >>card for at least two different networks, like so; > >>192.168.1.<somthing> and > >>alias 172.0.0.<something> > >>or; > >>192.168.1.<something> > >>alias 192.168.2.<something> > > > >Alias works fine. You have one primary address and many aliases. > > > >Put the ifconfig alias variable setting in your /etc/rc.conf or > >possibly rc.conf.local file. The syntax is: > > > ># Main (first) if config: > > ifconfig_xl0="inet 192.168.1.something netmask 255.248.0.0" > > > >The netmask needs to be whatever is correct for your situation. > > > ># All subsequent ifconfig variable setting are aliases as follows: > > ifconfig_xl0_alias0="192.168.2.something netmask 255.255.255.255" > > > >The 'xl0' is the NIC device. Each alias needs to have a unique > >number on it and then must be sequential starting with '0' - so the > >next alias would be 'alias1', etc. The netmask for aliases > >should be 255.255.255.255 > > > >>If this is possible is it accomplished via a special routing? > > > >Nope, standard stuff. > > > >>My concern is that I have a laptop with one network > >>interface, built in, but would like to access it both at > >>a public static address and a private network address. > >>Is this possible? > > > >Well, in this case you are really talking about two physical networks. > >So, for that you need two separate NICs. But, your NIC can respond > >to more than one network address on any given physical network by > >using aliases as mentioned above. > > > >////jerry > Thanks for the info; > What I am thinking is that the network interface can have only one > cable attached so it would have to go to a hub or a switch. The > DLS router would be connected to the same hub or switch as well > as the inside network. But that means that network traffic separated > by network number/subnet would travel over the same wire. It seems > to me that the machine with one interface would have to be connected > to a router rather than a hub or a switch if I understand it correctly. Many switches also contain routing as well nowdays. But, yes. In the case of how you describe it, there is no real reason to use more than one IP address on the machine running FreeBSD. The router/switch would sort that out and whichever part of your net was trying to get to it wouldn't matter. You just address the FreeBSD machine by hostname. The router/switch would just route the traffic to whatever address the machine has. Your router/switch becomes a NAT - providing it has the ability to be programmed that way. Otherwise, if it can't, it won't work anyway. Anyway, you really don't want to mix inside and outside traffic. You want to have your NAT system be the only one that knows about the inside addresses. The router will only be able to keep them separate if they are on separate wires. If they are both on the same wire, it won't matter what the router does. So, if the two networks are on different wires - which they must be - then you need two NICs. ////jerry > A > router would be able to distinguish and rout inside traffic inside and
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061115131127.GD11243>