Hello,
I have some trouble while trying to implement 2 ethernet interfaces connected via a bridge using netgraph. I am using FreeBSD 10.1 release. What I want to do seems to be as simple as shown in the code section below, however I can't make sending/receiving broadcast messages.
Network setup:
I followed as far as possible the example in /usr/share/examples/netgraph/ether.bridge, with the exceptions:
- I couldnt use hook lower while creating the bridge, and
- setting promiscuous mode/dont overwrite src address doesnt work
Tests:
Observations/Questions:
Interestingly the message at interface ngeth0 only shows up when exiting tcpdump using ^C.
Moreover I noticed that after running dhclient on interface ngeth0 the interface has been "configured" with ip/netmask 0.0.0.0/8 and broadcast address 255.255.255.255
More questions:
Why I cannot use hook "lower" ? (And what is actually the difference to hook "ether")
Why no broadcast messages arrived on interface ngeth1 ?
Thanks everybody,
plichel
I have some trouble while trying to implement 2 ethernet interfaces connected via a bridge using netgraph. I am using FreeBSD 10.1 release. What I want to do seems to be as simple as shown in the code section below, however I can't make sending/receiving broadcast messages.
Code:
--------------- ---------------
| ngeth0 | | ngeth1 |
| (ng_eiface) | | (ng_eiface) |
--------------- ---------------
| |
| |
--------------------------------
| br0 |
| (ng_bridge) |
--------------------------------
Network setup:
I followed as far as possible the example in /usr/share/examples/netgraph/ether.bridge, with the exceptions:
- I couldnt use hook lower while creating the bridge, and
- setting promiscuous mode/dont overwrite src address doesnt work
Code:
#create 2 eithernet interfaces
ngctl mkpeer . eiface hook ether
ngctl mkpeer . eiface hook ether
#create bridge and attach the first interface
//ngctl mkpeer ngeth0: bridge lower link0 (doesnt work hook lower not allowed: Protocol family not supported)
ngctl mkpeer ngeth0: bridge ether link0
//ngctl name ngeth0:lower br0 (doesnt work as above)
ngctl name ngeth0:ether br0
#attach the 2nd interface
ngctl connect ngeth1: br0: ether link1
#assign MAC
ifconfig ngeth0 ether 01:02:03:04:05:01
ifconfig ngeth1 ether 01:02:03:04:05:02
#trying to set up promiscous mode fails
ngctl msg ngeth0: setpromisc 1
ngctl: send msg: Function not implemented
#status according to ifconfig
ngeth0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=28<VLAN_MTU,JUMBO_MTU>
ether 01:02:03:04:05:01
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
ngeth1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=28<VLAN_MTU,JUMBO_MTU>
ether 01:02:03:04:05:02
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
#status according to ngctl l
Name: br0 Type: bridge ID: 00000033 Num hooks: 2
Name: ngctl1623 Type: socket ID: 00000039 Num hooks: 0
Name: ngeth0 Type: eiface ID: 0000002c Num hooks: 1
Name: ngeth1 Type: eiface ID: 0000002e Num hooks: 1
Code:
#produce DHCPDISCOVER messages using dhclient:
dhclient ngeth0
DHCPDISCOVER on ngeth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on ngeth0 to 255.255.255.255 port 67 interval 6
^C
#capture traffic on ngeth0
tcpdump -i ngeth0
tcpdump: WARNING: ngeth0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ngeth0, link-type EN10MB (Ethernet), capture size 65535 bytes
21:21:36.459845 IP 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 01:02:03:04:05:01 (oui Unknown), length 300
^C
1 packet captured
2 packets received by filter
0 packets dropped by kernel
#capture traffic at ngeth1 (nothing shows up)
tcpdump -i ngeth1
tcpdump: WARNING: ngeth1: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ngeth1, link-type EN10MB (Ethernet), capture size 65535 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel
Interestingly the message at interface ngeth0 only shows up when exiting tcpdump using ^C.
Moreover I noticed that after running dhclient on interface ngeth0 the interface has been "configured" with ip/netmask 0.0.0.0/8 and broadcast address 255.255.255.255
More questions:
Why I cannot use hook "lower" ? (And what is actually the difference to hook "ether")
Why no broadcast messages arrived on interface ngeth1 ?
Thanks everybody,
plichel