Dragonfly BSD 4.0.x
Networking in Dragonfly BSD
All Network configuration is done in /etc/rc.conf.
- Unlike Linux the NIC's are identified by the driver they are using.
In our example, we use an Intel NIC being addressed as em0
Usually the System Installer configures the initial IPv4-Network. It looks like:
defaultrouter="188.8.131.52" hostname="Dragon.example.com" ifconfig_em0="inet 184.108.40.206 netmask 255.255.255.224"
Don't forget to add an Nameserver to /etc/resolv.conf
nameserver 220.127.116.11 # Google DNS
Native IPv4 DHCP Client
.... #IPv4 ifconfig_em0="DHCP" # via installer configuration ...
Localhost address in a Jail
It is sufficient to define an alias of the localhost-Device (lo0) and add it to the jail.
Here's an example (/etc/rc.conf).
.... ifconfig_lo0_alias2="inet 127.0.0.12 netmask 255.255.255.255" .... jail_www_ip="127.0.0.12,2111:a610:f112:3:f:ff:fff:23" ....
Manual configuration of an IPv6 address
ifconfig em0 inet6 2a01:1e8:e18e:1::3 prefixlen 64
IPv6 static address
#IPv6 Config ipv6_enable="YES" ipv6_network_interfaces="em0" ipv6_ifconfig_em0="2111:a610:f112:3:f:ff:fff:23 prefixlen 64" ipv6_defaultrouter="2111:a610:f112:3:f::1"
Link-local addresses will be configured automatically for each real NIC.
ifconfig em0 shows us .
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING> ...... inet6 fe80::2e6:e7ff:fece:fc12%em0 prefixlen 64 scopeid 0x1 ...... ether 00:e6:e7:ce:fc:12 media: Ethernet autoselect (1000baseT <full-duplex>) status: active
As far as i know, there is no way to create a Link-local address manually, therfore you cannot create an alias.
Conclusion: There is only one Link-local address per NIC.
Link-local address in a Jail
You can assign a Link-local address to an specific Jail. Therfore you you need to know the scope address of the host.
The scope address tells the host which Link-local address belongs to which NIC. See here: http://en.wikipedia.org/wiki/IPv6_address
You can identify the Scope Address using ifconfig
inet6 fe80::2e6:e7ff:fece:fc12%em0 prefixlen 64 scopeid 0x1
In this example Scope would be 1.
You have to modify the Link-local address, using the scope id.
When you assign the Link-local address of the host to the Jail you have to use the modified Link-local address fe80:1::2e6:e7ff:fece:fc12
When you enter the Jail you can see the original Link-local address of the host.
ifconfig em0 em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING> inet6 fe80::2e6:e7ff:fece:fc12%em0 prefixlen 64 scopeid 0x1 ............. ether 00:e6:e7:ce:fc:12 media: Ethernet autoselect (1000baseT <full-duplex>) status: active
Problem with the Gateway
When using Dragonfly BSD in an virtualized environment, you encounter an very interesting problem. After boot-up the machine is unable to route packages through the default gateway. It seems the Gateway is dead.
But you can wake it up by pinging it right after booting.
For example, if your Gateway is fe80::1%em0 a simple
fafnir# ping6 -c3 fe80::1%em0
I have encountered the problem with the Netcup KVM - VM (https://www.netcup.de/vserver/) and my own local virtual machines using CentOS 7 with kvm. In my local environment (CentOS 7) i had to ping the virtual Bridge (virbr), before routing went online.
To automate that magic ping we create a Start-script. Place the script at the bottom of /etc/rc.conf so it is executed at the very end.
#ping fe80::1%em0 to activate it fe80start_enable="YES"
Create the Script in /usr/local/etc/rc.d/fe80start :
. /etc/rc.subr name=fe80start rcvar=fe80start_enable command="ping6 -c3 fe80::1%em0" load_rc_config $name run_rc_command "$1"
Don't forget to
chmod 555 /usr/local/etc/rc.d/fe80start
If IPv6 is enabled in /etc/rc.conf/ Dragonfly BSD tries to fetch itself an link-local and an global Ipv6 address. No further measures are needed.
... #IPv6 Config ipv6_enable="YES" ipv6_network_interfaces="em0" ...
Dont't forget to ping your Gateway as described above !