ce74 Configure 2 NIC FreeBSD server as a WAN switch - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Server & Networking > Networking

Networking Network related discussions (including general TCP/IP stuff, routing, etc).

Reply
 
Thread Tools Display Modes
  #1  
Old January 22nd, 2012, 05:06
ethoms ethoms is offline
Junior Member
 
Join Date: Feb 2009
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Configure 2 NIC FreeBSD server as a WAN switch

Basically I want to configure a FreeBSD (8.2) server to act like a network switch. One cable from fibre optic modem coming in on one NIC. And one cable going out from NIC 2 on the same subnet (an 16 public IP block from ISP) to a layer 2 network switch, to the other servers using the public subnet. Can this be done? I'm going to try it by setting up both NICs on same subnet, different IPs and then set
Code:
gateway_enable="YES"
in rc.conf. Just doing some research before I go to the office and start disrupting the connection.

Why not just use a switch between the modem and WAN facing NICs?

Because the back end (ISP) doesn't like talking to layer 2 devices, couldn't send email to yahoo, yet every other mail domain worked fine. I've tried using the router they supplied, split my public subnet into two; one on each interface, bridged them, and then put the switch behind that. Because the router is layer 3, it solved my sending to yahoo mail problem but I only get half my internet upload speed.

I've tried so many different configurations, each switch I use has slightly different behaviour. Basically the internet connection and/or the modem seem very fussy about the hardware it talks to. One things for sure, If I connect a server directly to the modem, I get full speed, infact I get double the upload speed I should be getting on my contract. So, I thought I'd let FreeBSD do my networking, I'm confident it can get more out of my connection than these damn off-the-shelf routers/switches.

The cable modem is 100Mb/s full duplex. I need a good networking stack (FreeBSD) to buffer this as I'm convinced it's the speed and duplex on different links that's causing the problems.

How can I do this, one cable from modem to FreeBSD server, service running on this FreeBSD server, then share through a second NIC and switch to another server (Solaris) also running internet services.

All the guides / documentation I can find regarding gateways / routers are related to 2 subnets. But I want to do only with one public subnet.

Last edited by ethoms; January 28th, 2012 at 10:44.
Reply With Quote
  #2  
Old January 22nd, 2012, 06:29
phoenix's Avatar
phoenix phoenix is offline
Moderator
 
Join Date: Nov 2008
Location: Kamloops, BC, Canada
Posts: 3,144
Thanks: 43
Thanked 703 Times in 579 Posts
Default

Can you draw a diagram of the network topology? Not exactly sure what you are trying to do, but it sounds like bridging is what you need.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
  #3  
Old January 23rd, 2012, 02:11
ethoms ethoms is offline
Junior Member
 
Join Date: Feb 2009
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thought of bridging first of all, but it didn't work. I managed to create a bridge0 and set it a valid IP + subnet. From what I remember, it would ping out if the internet facing NICs was plugged but as soon as the other NIC was pluggged it couldn't route to anything. Perhaps I needed the gateway_enable="YES" option set. Will try again when I go to office.

Network diagram:

Code:
ISP gateway (200.200.200.113)
           |
           |
Fibre Optic Modem (100baseTX full-duplex)  
           |
           |
         [NIC1]
FreeBSD Gateway/Server (200.200.200.119{host},200.200.200.120{jail},200.200.200.121{jail})
         [NIC2]
           |
           |
     <<<<<< >>>>>>>>>>>>>>>>>>>>>
     |                          |
     |                          |
Solaris Global Zone{host}     Solaris Zone 1
(200.200.200.116)            (200.200.200.118)

Last edited by ethoms; January 23rd, 2012 at 02:17.
Reply With Quote
  #4  
Old January 24th, 2012, 10:00
ecazamir ecazamir is offline
Member
 
Join Date: Mar 2009
Posts: 215
Thanks: 5
Thanked 28 Times in 26 Posts
Default

The proper syntax is:
Code:
gateway_enable="YES"
without the ending 'd'.

An alternate method to permanently enable packet forwarding is to set in /etc/sysctl.conf
Code:
net.inet.ip.forwarding=1
Or temporary, executing
Code:
sysctl net.inet.ip.forwarding=1
__________________
My blog: http://ghid-it.blogspot.com
Other guides: http://sites.google.com/site/ghidit/
Reply With Quote
  #5  
Old January 28th, 2012, 10:46
ethoms ethoms is offline
Junior Member
 
Join Date: Feb 2009
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

@ecazamir: Thanks, don't know where that d came from, I've edited it out.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure a NIC on FreeBSD host so it's dedicated to VirtualBox VM LSDave Networking 6 September 11th, 2011 06:10
FreeBSD server WAN/IP online/IP denkikoiji Networking 3 June 22nd, 2011 02:09
Sunfire V20z - WAN Speeds only 10Mbps on GigE NIC datachild Networking 7 March 1st, 2011 12:29
[pfSense] Multiple WAN NIC, how to choose which one is used by fetch jimjxr Networking 2 June 29th, 2010 16:41
Jails in a 2 NIC server zeissoctopus General 5 November 23rd, 2009 08:03


All times are GMT +1. The time now is 05:11.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0