Sample Header Ad - 728x90

cant connect tap interface with eth

1 vote
1 answer
1130 views
I wrote a simple c program which can send and receive ether net frames using /dev/net/tun and I connected the tap interface with my ethernet nic using both the virtual bridge and veth pair. I expected to see some traffic from my tap while capturing the ethernet card. the problem is see my packets coming from tap0 and i see them arriving at the bridge but i cant see arrive anything while capturing the ethernet card. To be honest I have no idea what I am doing and so I tried configuring the bridge with netplan config files, brctl, ip and ifconfig. I tried adding ip addresses of same subnet to br0 tap and enp8s0 and i tried to just give an ip adress to the bridge always with the same result, same thing while using veth currently my setup is: #create tap0 sudo ip tuntap add tap0 mode tap sudo ip link set tap0 promisc on #create Br0 sudo ip link add br0 type bridge sudo ip link set enp8s0 promisc on #set to up sudo ip link set br0 up #To add an interface br0s state must be up sudo ip link set enp8s0 up #To add an interface its state must be up sudo ip link set dev tap0 up #To add an interface its state must be up #Adding the interface into the bridge is done by setting its master to bridge_name: sudo ip link set enp8s0 master br0 sudo ip link set tap0 master br0 sudo ip addr add dev br0 192.168.4.10/24 i am writing this structure to the tap filedescriptor: struct eth_hdr { unsigned char h_dest ; unsigned char h_source ; uint16_t ethertype; unsigned char payload[]; } __attribute__((packed)); wireshark shows a valid ethernet frame but i am not sure what source mac would be appropriate what can i do to get my ethernet headers from tap0 to enp8s0
Asked by KingKoopa (11 rep)
Jan 1, 2021, 05:14 PM
Last activity: Jan 4, 2021, 02:23 PM