Installing a dual NIC instance in FreeBSD

Source: Internet
Author: User
Tags new set

When we use FreeBSD as a gateway or firewall, we require two network cards to be installed in the system, spanning two networks, one card for the external network, and the other for the internal network. Well, as you know, it's time to get the system to support these new devices, and for the network adapters, FreeBSD is supported by a custom kernel. Of course, first let the kernel understand the hardware resources used by the device, for the NIC using the PCI interface, I can only say that the High-tech is really happy, because this kind of network card in the PCI PnP Bois support, as long as a more than one device configuration in the kernel can be automatically detected and started when the new kernel boot, and for the ISA card , there is no such a simple, but as long as the PNP with jumpless mode, with the card with the Setup program to set the appropriate resources, you can use the appropriate configuration in the kernel to inform the system at boot time to use such resources to start the device. Let's look at the specific steps:

1, customize the new kernel to adapt to the new equipment

Here's a question to note, as we all know, the custom kernel needs to install at least the original code "kernel source code" (FreeBSD Kernel Sources) in the system, which was not previously installed and can be added with/stand/sysinstall.

For a PCI network card, for example, you are using Realtek 8139, you can add a row to the kernel configuration file:

Device De0 # Your original DC21040 Ethernet adapters

Device Rl0 # Newly added Realtek 8139, because it is a PCI card, the system will automatically detect card resources

For an ISA network card, for example, you are using a NE2000 compatibility card, also add a description line in the kernel configuration file that matches a set of resources:

Device De0 # Your original DC21040 Ethernet adapters

Device ed0 at Isa? Port 0x300 net IRQ 3 iomem 0xd8000 Vector edintr

The second line above is the newly joined NE2000 compatible NIC, because it is an ISA card, so be sure to specify the resources used by the card so that the system can be detected at boot time. You may ask, if you are using the same chip type of card, how to configure it? You can do this:

Device ed0 at Isa? Port 0x300 net IRQ 3 iomem 0xd8000 Vector edintr

Device ed1 at Isa? Port 0x320 net IRQ iomem 0xd8000 vector edintr

As you can see, there are multiple devices of the same type, followed by the UNIX numbering habit of ed0, ed1 .... However, in the above configuration, the two cards of the bootrom resources will conflict, but does not affect the boot, you can use the card with the Setup program to set them properly.

Now that the new kernel configuration has been customized as required, it's time to compile and install the new kernel as described in FreeBSD Handbook. Compile work everything goes well. Our system has already supported the new NIC device, next is to configure the corresponding network interface for the new network card.

2. Add new network interface

A simpler and more intuitive approach is to use/stand/sysinstall to configure a new interface for a new set of parameters, of course, the BSD traditional method is to modify the corresponding configuration file to achieve the goal, edit/etc/rc.conf:

Hostname= "Example.host.net"

network_interfaces= "Ed0 ed1 lo0"

# Add a new network interface above to initialize with a later ifconfig configured parameter at boot time

ifconfig_ed0= "inet 192.168.0.1 netmask 255.255.255.0" # Original network interface parameters

ifconfig_ed1= "inet 192.168.1.1 netmask 255.255.255.0" # New network interface parameters

Defaultroute= "xxx.xxx.xxx.xxx" # Original network default route

Well, the installation of dual network card work is completed, the future can be based on the specific use of the configuration of NAT, Gateway and other Dongdong.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.