The following script creates a point-to-point link between jails.


# script to create two vnet jails and connect them via ng_iface interfaces

# create two vnet jails
jail -c vnet name=node0 host.hostname=node0 path=/ persist
jexec node0 ifconfig lo0 localhost

jail -c vnet name=node1 host.hostname=node1 path=/ persist
jexec node1 ifconfig lo0 localhost

# create two ng_ifaces and connect them in netgraph
ngctl mkpeer . iface hook inet
ngctl mkpeer ng0: iface inet inet

# move the corresponding interfaces into the jails
ifconfig ng0 vnet node0
ifconfig ng1 vnet node1

# configure the interfaces in the jails
jexec node0 ifconfig ng0
jexec node1 ifconfig ng1

# end of script

When I try to ping node1 from node0 the echo request appears on ng1 according 
to tcpdump on node1 but node1 does not generate an echo reply.  Here is the 
output generated on each jail.

[r...@gateway /home/phillips]# jexec node0 ping -c1
PING ( 56 data bytes

--- ping statistics ---
1 packets transmitted, 0 packets received, 100.0% packet loss

[r...@gateway /home/phillips]# jexec node1 tcpdump -n -i ng1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ng1, link-type NULL (BSD loopback), capture size 96 bytes
20:31:38.509494 IP > ICMP echo request, id 55300, 
seq 0, length 64

This is for FreeBSD8.1 with kernel config GENERIC with the following changes:

#options        SCTP                    # Stream Control Transmission Protocol

options         VIMAGE
options         IPFIREWALL              #firewall
options         IPFIREWALL_DEFAULT_TO_ACCEPT    #allow everything by default
options         MROUTING                # Multicast routing

Bill Phillips

freebsd-virtualization@freebsd.org mailing list
To unsubscribe, send any mail to 

Reply via email to