Need help fixing the bridge connection between Linux Devuan 5 and FreeBSD 13.2 (virtualized with qemu + kvm + libvirt)

Status
Not open for further replies.
Hello.

I'm trying to setup a bridge on Linux Devuan 5 (host os) with the goal to give the connectivity to FreeBSD 13.2,that I have virtualized with qemu-kvm-libvirt. This is the guide that I'm following :




According with the guide and with the routing table that I have on Linux :


Code:
# route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 
default         modemtim        0.0.0.0         UG    0      0        0 mlan0
default         modemtim        0.0.0.0         UG    600    0        0 mlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 mlan0
modemtim        0.0.0.0         255.255.255.255 UH    0      0        0 mlan0


Instead,these are the starting network interfaces on the system : (the laptop is connected to the internet via Wi-Fi)


Code:
# ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
inet 127.0.0.1  netmask 255.0.0.0
inet6 ::1  prefixlen 128  scopeid 0x10<host>
loop  txqueuelen 1000  (Local Loopback)
RX packets 25  bytes 3472 (3.3 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 25  bytes 3472 (3.3 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


mlan0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
inet 192.168.1.6  netmask 255.255.255.0  broadcast 192.168.1.255
ether 60:21:c0:e9:44:63  txqueuelen 1000  (Ethernet)
RX packets 131  bytes 16495 (16.1 KiB)
RX errors 0  dropped 0  overruns 0  frame 0
TX packets 106  bytes 16066 (15.6 KiB)
TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


this is how I have configured the bridge on Linux :


Code:
# ip tuntap add tap0 mode tap
# brctl addbr br0
# ip link set dev br0 up
# ip addr add 192.168.1.0/24 dev br0
# iptables -t nat -A POSTROUTING -o mlan0 -j MASQUERADE
# echo 1 > /proc/sys/net/ipv4/ip_forward
# brctl addif br0 tap0

this is how the network interfaces are configured after having issued those commands :

Code:
# ifconfig

br0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
       inet 192.168.1.0  netmask 255.255.255.0  broadcast 0.0.0.0
       inet6 fe80::c8a6:4bff:fe41:fb04  prefixlen 64  scopeid 0x20<link>
       ether ba:7a:f2:83:cd:be  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 37  bytes 6215 (6.0 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
       inet 127.0.0.1  netmask 255.0.0.0
       inet6 ::1  prefixlen 128  scopeid 0x10<host>
       loop  txqueuelen 1000  (Local Loopback)
       RX packets 26  bytes 3603 (3.5 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 26  bytes 3603 (3.5 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

mlan0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
       inet 192.168.1.7  netmask 255.255.255.0  broadcast 192.168.1.255
       inet6 fe80::32c4:8b0e:6ceb:c104  prefixlen 64  scopeid 0x20<link>
       ether 60:21:c0:e9:44:63  txqueuelen 1000  (Ethernet)
       RX packets 1009  bytes 83261 (81.3 KiB)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 375  bytes 48458 (47.3 KiB)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tap0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
       ether ba:7a:f2:83:cd:be  txqueuelen 1000  (Ethernet)
       RX packets 0  bytes 0 (0.0 B)
       RX errors 0  dropped 0  overruns 0  frame 0
       TX packets 0  bytes 0 (0.0 B)
       TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


this is the routing table now :


Code:
# route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         modemtim        0.0.0.0         UG    0      0        0 mlan0
default         modemtim        0.0.0.0         UG    600    0        0 mlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     600    0        0 mlan0
modemtim        0.0.0.0         255.255.255.255 UH    0      0        0 mlan0



This is how I start the virtualization of FreeBSD :


Code:
UEFICODE1=/usr/share/AAVMF/AAVMF32_CODE.fd
UEFIVARS2=/usr/share/AAVMF/AAVMF32_VARS.fd
DISK=/Dati/img/FreeBSD-13.2-RELEASE-arm-armv7-GENERICSD.img

qemu-system-arm -enable-kvm -serial stdio -m 1024 -M virt -cpu cortex-a15 \
-drive if=pflash,format=raw,unit=0,file=$UEFICODE1 \
-drive if=pflash,format=raw,unit=1,file=$UEFIVARS2 \
-drive file=$DISK,media=disk,format=raw \
-net nic,model=virtio,macaddr=52:54:00:12:34:55 -net tap,ifname=tap0 \
-device virtio-gpu-pci \
-usb -device nec-usb-xhci -device usb-kbd -device usb-mouse \
-device vmware-svga,id=video0,vgamem_mb=16


These are the config files that I have modified within FreeBSD :


Code:
/etc/rc.conf :

ifconfig_vtnet0="inet 192.168.1.2/24"
defaultrouter="192.168.1.1"

/boot/loader.conf

if_tap_load="YES"
if_bridge_load="YES"
bridgestp_load="YES"

/etc/sysctl.conf

net.link.tap.up_on_open=1
net.inet.ip.forwarding=1
net.inet.ip.random_id=1

/etc/resolv.conf

search homenet.telecomitalia.it
nameserver 192.168.1.1
nameserver 8.8.8.8


Below you can see the messages regarding the network configuration that are displayed when FreeBSD started booting :


Code:
lo0: link state changed to UP
vtnet0: link state changed to UP
Starting Network: lo0 vtnet0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
vtnet0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 52:54:00:12:34:55
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.
eval: cannot open /dev/ttyv0: No such file or directory
eval: cannot open /dev/ttyv0: No such file or directory
Configuring vt: keymapeval: cannot open /dev/ttyv0: No such file or directory
.
Starting ums0 moused.
eval: cannot open /dev/ttyv*: No such file or directory
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add net default: gateway 192.168.1.1
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Starting local_unbound.
Waiting for nameserver to start... good


Ifconfig on FreeBSD :


Code:
# ifconfig

vtnet0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
        ether 52:54:00:12:34:55
        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
        media: Ethernet autoselect (10Gbase-T <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

Routing table on FreeBSD :

Code:
# netstat -rn

Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            192.168.1.1        UGS      vtnet0
127.0.0.1          link#2             UH          lo0
192.168.1.0/24     link#1             U        vtnet0
192.168.1.2        link#1             UHS         lo0

Internet6:
Destination                       Gateway                       Flags     Netif Expire
::/96                             ::1                           URS         lo0
::1                               link#2                        UHS         lo0
::ffff:0.0.0.0/96                 ::1                           URS         lo0
fe80::/10                         ::1                           URS         lo0
fe80::%lo0/64                     link#2                        U           lo0
fe80::1%lo0                       link#2                        UHS         lo0
ff02::/16                         ::1                           URS         lo0

what's the problem,then ? this one :

Code:
# ping google.com
ping: Unknown host


what I can ping and what not :


Code:
# ping 192.168.1.2

PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: icmp_seq=0 ttl=64 time=0.189 ms
64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=0.132 ms

but it can't ping the Linux IP number

Code:
# ping 192.168.1.6

PING 192.168.1.6 (192.168.1.6): 56 data bytes
ping: sendto: Host is down
ping: sendto: Host is down
ping: sendto: Host is down

neither the gateway :

Code:
# ping 192.168.1.1

PING 192.168.1.1 (192.168.1.1): 56 data bytes
ping: sendto: Host is down
ping: sendto: Host is down

what's the problem ? I really don't understand. (I haven't installed any firewall on the system).
 
i'm no linux expert but
in such a setup you don't need iptables, nat
just brctl addif br0 mlan0
brctl addif br0 tap0
also you don't need an ip on br0
the vm can set the same gw as the host
 
so,you say to do this on linux :

Code:
# brctl addbr br0
# brctl addif br0 mlan0
# brctl addif br0 tap0

and this on freebsd ?

Code:
/etc/rc.conf :

ifconfig_vtnet0="DHCP"

what about /etc/resolv.conf ? is this right ?


Code:
/etc/resolv.conf

search homenet.telecomitalia.it
nameserver 192.168.1.1
nameserver 8.8.8.8
 
Code:
# brctl addbr br0 
# brctl addif br0 mlan0 
can't add mlan0 to bridge br0: Operation not supported
 
I run a FreeBSD VM KVM client on Debian. The IP address of the Debian system is 192.168.1.26. The hardware NIC is enp3s0, which is bridged to all the KVM virtual machines -- so they are all on the same subnet, and thus have the same subnet mask, and default gateway, and generally use identical copies of /etc/resolv.conf.

Here is (an extract of) what I use for /etc/network/interfaces on the Debian host:
Code:
# The loopback network interface
auto lo
iface lo inet loopback

# product: 82579V Gigabit Network Connection
# vendor: Intel Corporation
auto enp3s0
iface enp3s0 inet manual

auto br0
iface br0 inet static
        address 192.168.1.26
        netmask 255.255.255.0
        gateway 192.168.1.254
        bridge_ports enp3s0
        bridge_stp off
        bridge_maxwait 0
        bridge_fd 0
Here is what I use on the FreeBSD VM:
Code:
ifconfig_vtnet0="inet 192.168.1.22 netmask 255.255.255.0"
defaultrouter="192.168.1.254"
Your use of DHCP is fine. My hosts are permanent, and get a static IP Address.

There is no specific virtualisation-related need to use iptables on Linux, or packet filters on FreeBSD.

I use a completely separate firewall to protect all hosts on my network.

Edit: what's shown above is all that I do. There is no other configuration or setup required.
 
it freezes here :

  • Code:
    Clear IP of eth0 (for me it is mlan0)
    ip addr flush dev mlan
    
    frozen,nothing happens.

but I will try to don't issue this command,maybe it works the same.
 
Experiment n.1 :

(followup of : https://forums.FreeBSD.org/threads/...lized-with-qemu-kvm-libvirt.90486/post-623871)

Code:
./rete.sh

# brctl addbr br0
# brctl addif br0 mlan0
# tunctl -t tap0 -u `whoami`
# brctl addif br0 tap0
# ifconfig mlan0 up
# ifconfig tap0 up
# ifconfig br0 up
# dhclient -v br0
# brctl show


can't add mlan0 to bridge br0: Operation not supported
Set 'tap0' persistent and owned by uid 0
Internet Systems Consortium DHCP Client 4.4.3-P1
Copyright 2004-2022 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/br0/76:ab:b9:7e:35:f0
Sending on   LPF/br0/76:ab:b9:7e:35:f0
Sending on   Socket/fallback
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 6
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on br0 to 255.255.255.255 port 67 interval 9
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

# brctl show

bridge name     bridge id               STP enabled     interfaces
br0             8000.76abb97e35f0       no              tap0

# ifconfig

br0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 76:ab:b9:7e:35:f0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 21  bytes 3212 (3.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 21  bytes 3212 (3.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

mlan0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC>  mtu 1500
        inet 192.168.1.7  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::3a7e:42c9:327a:c11b  prefixlen 64  scopeid 0x20<link>
        ether 60:21:c0:e9:44:63  txqueuelen 1000  (Ethernet)
        RX packets 575  bytes 53650 (52.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 419  bytes 56393 (55.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

tap0: flags=-28669<UP,BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 76:ab:b9:7e:35:f0  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
Experiment n.2 :

Followup of :


I've added this content on the file /etc/network/interfaces :

Code:
auto mlan0
iface mlan0 inet manual

auto br0
iface br0 inet static
        address 192.168.1.26
        netmask 255.255.255.0
        gateway 192.168.1.254
        bridge_ports mlan0
        bridge_stp off
        bridge_maxwait 0
bridge_fd 0

I've rebooted,I did:

Code:
# ip link set dev br0 up

this is what says ifconfig :

Code:
# ifconfig

br0: flags=-28670<BROADCAST,MULTICAST,DYNAMIC>  mtu 1500
        ether 3a:0b:6d:ba:79:18  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 16  bytes 1667 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 25  bytes 3242 (3.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25  bytes 3242 (3.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
mlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.6  netmask 255.255.255.0  broadcast 192.168.1.255
        ether 60:21:c0:e9:44:63  txqueuelen 1000  (Ethernet)
        RX packets 433  bytes 40082 (39.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 234  bytes 30629 (29.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

as you can see to br0 hasn't been assigned the IP : 192.168.1.26.
 
I've been in pretty similar situation few days ago. I've pluged 4x ifint in my ubuntu workstation and crawled along settings trying to create connection between my freebsd backup host to the rest of the private network, where ubuntu with this card was in the middle. I've assigned ip to the interface facing freebsd host, and had gain access to this host but only from this ubuntu. I've ended experiment with thought that probably only routes can't bridge that whole inside ubuntu, great, now the clue with bridge can deal the case.
 
why are linux-specific problems discussed here? this will mislead anyone who might search for an actual FreeBSD/bridges related problem...


7. We will not allow technical/support questions about any operating system other than FreeBSD anywhere on this forum. That includes the Off-Topic forum. Always ask technical/support questions about other operating systems on the forums or mailing lists associated with those operating systems.
 
why are linux-specific problems discussed here? this will mislead anyone who might search for an actual FreeBSD/bridges related problem...



because I didn't know where the problem could be. In my ignorance it could be on the FreeBSD part (or it could have depended at least in part on this). I've opted for this forum because I like it. Anyway,I will make the post on a Linux forum,too.
 
is mlan0 a wifi device ?
if it is bridgeing to it wont work

why ? can you give some direction about how could I do to establish a connection between host and guest where the guest can be seen from outside ? I'm thinking to a converter from usb to ethernet,but without the needing of a driver,that probably will not exist for this architecture (armv7).
 
in the case if the problem is on 255.254 part
Code:
ihor@ihor-HP:~$ ip a sh
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 78:ac:c0:98:00:d4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.50.125/24 brd 192.168.50.255 scope global dynamic noprefixroute enp1s0
       valid_lft 3223sec preferred_lft 3223sec
3: ens1f0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:21:57:3f:c8 brd ff:ff:ff:ff:ff:ff
    altname enp5s0f0
4: ens1f1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:1b:21:57:3f:c9 brd ff:ff:ff:ff:ff:ff
    altname enp5s0f1
5: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether 00:1b:21:57:3f:cc brd ff:ff:ff:ff:ff:ff
    altname enp6s0f0
    inet 172.16.17.18/12 brd 172.31.255.255 scope global noprefixroute eth2
       valid_lft forever preferred_lft forever
    inet6 fe80::df6f:502e:c663:b84b/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
6: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether 00:1b:21:57:3f:cd brd ff:ff:ff:ff:ff:ff
    altname enp6s0f1
7: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether d2:e5:09:79:2f:36 brd ff:ff:ff:ff:ff:ff
ihor@ihor-HP:~$ ping 172.31.255.254
PING 172.31.255.254 (172.31.255.254) 56(84) bytes of data.
^C
--- 172.31.255.254 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

ihor@ihor-HP:~$ ip route show
default via 192.168.50.3 dev enp1s0 proto dhcp src 192.168.50.125 metric 100 
default via 172.16.0.1 dev eth2 proto static metric 20101 
169.254.0.0/16 dev enp1s0 scope link metric 1000 
172.16.0.0/12 dev eth2 proto kernel scope link src 172.16.17.18 metric 101 
172.31.255.254 via 172.16.17.18 dev eth2 proto static metric 101 
192.168.50.0/24 dev enp1s0 proto kernel scope link src 192.168.50.125 metric 100 
ihor@ihor-HP:~$ ping 172.31.255.254
PING 172.31.255.254 (172.31.255.254) 56(84) bytes of data.
^C
--- 172.31.255.254 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1030ms
any clues ?
 
if mlan0 is wifi then you setup routed mode for the vm

in linux delete anything with br0
bring back iptables, nat
ifconfig tap0 192.168.99.1/24

in vm/bsd ifconfig_vtnet0="inet 192.168.99.2/24"
defaultrouter="192.168.99.1"
 
It's was, at first, an interoperability issue. And on that basis I let it slide. But don't turn this thread into a Linux tutorial.
 
if mlan0 is wifi then you setup routed mode for the vm

in linux delete anything with br0
bring back iptables, nat
ifconfig tap0 192.168.99.1/24

in vm/bsd ifconfig_vtnet0="inet 192.168.99.2/24"
defaultrouter="192.168.99.1"

According with your suggestion and with my intuition,it could be something like this :

Code:
Linux :

iptables -t nat -A POSTROUTING -o mlan0 -j MASQUERADE
ip tuntap add tap0 mode tap
ip link set dev tap0 up
ifconfig tap0 192.168.99.1/24
echo 1 > /proc/sys/net/ipv4/ip_forward

FreeBSD :

ifconfig_vtnet0="inet 192.168.99.2/24"
defaultrouter="192.168.99.1"

/etc/resolv.conf

search homenet.telecomitalia.it
nameserver 8.8.8.8

but it does not work :

# ping google.com
unknown host.
 
does ping 192.168.99.1 work from freebsd ?
if it does ping 8.8.8.8 from bsd and tcpdump -i mlan0 -nl on linux
shouldn't this be with mlan ?
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
 
In order to bridge a Linux wifi interface you need to assign it to an access point. hostapd would be the easiest way to accomplish this.
With hostapd and the bridge interface up, you can add a copper interface (or any other L2-interface) to the bridge.

As stated above, iptables (which is deprecated anyway, or at least outdated) and SNAT / MASQUERADING shouldn't be necessary.
 
does ping 192.168.99.1 work from freebsd ?

yes.

-> Does ping 8.8.8.8 ?

no.

From Linux :

Code:
# tcpdump -i mlan0 -nl

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on mlan0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:56:49.088123 IP 192.168.1.7.22 > 192.168.1.2.46156: Flags [P.], seq 2204966314:2204966446, ack 2991518420, win 501, options [nop,nop
,TS val 3095814036 ecr 2988482883], length 132
15:56:49.088656 IP 192.168.1.7.22 > 192.168.1.2.46156: Flags [P.], seq 132:232, ack 1, win 501, options [nop,nop,TS val 3095814037 ecr
2988482883], length 100
15:56:49.089879 IP 192.168.1.2.46156 > 192.168.1.7.22: Flags [.], ack 132, win 8746, options [nop,nop,TS val 2988482950 ecr 3095814036]
, length 0
15:56:49.090141 IP 192.168.1.2.46156 > 192.168.1.7.22: Flags [.], ack 232, win 8746, options [nop,nop,TS val 2988482951 ecr 3095814037]
, length 0

ok,I'd thought to mlan0 but I wrote wlan0,sorry. I've rebooted and I gave this command on Linux :

Code:
# iptables -t nat -A POSTROUTING -o mlan0 -j MASQUERADE

but It hasn't fixed the problem :

# ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8): 56 data bytes

frozen.
 
In order to bridge a Linux wifi interface you need to assign it to an access point. hostapd would be the easiest way to accomplish this.
With hostapd and the bridge interface up, you can add a copper interface (or any other L2-interface) to the bridge.

As stated above, iptables (which is deprecated anyway, or at least outdated) and SNAT / MASQUERADING shouldn't be necessary.

ok thanks. Can you point me to a tutorial that I can follow to try this kind of configuration ? Because your explanation is good,but not useful for a newbie like me. I mean : I don't know what to do without having the chance to read and experiment with a good tutorial.
 
for routing mode you also need this
echo 1>/proc/sys/net/ipv4/ip_forward
and then while pinging from bsd
tcpdump -i mlan0 -nl icmp
 
Status
Not open for further replies.
Back
Top