Basically I am trying to create a custom TCP Stack. As you might know I cant use eth0 because linux kernel TCP stack uses that, Due to that I need to create a tun/tap interface and use it for my Custom TCP Stack.


auto lo
iface lo inet loopback

allow-hotplug eth0
auto eth0
iface eth0 inet static

allow-hotplug tap0
auto tap0
iface tap0 inet manual
    pre-up ip tuntap add tap0 mode tap user root
    pre-up ip addr add dev tap0
    up ip link set dev tap0 up
    post-up ip route del dev tap0
    post-up ip route add dev tap0
    post-down ip link del dev tap0


inet addr: bcast: netmask

    inet addr: mask

    inet addr: bcast: mask

with following config I can reach wan/lan using eth0 but I cant reach not even my gateway with tap0.

I would really appreciate if you could tell me what mistake am I making here?

  • Are you trying to bridge eth0 and tap0 (have this machine act as if it were an Ethernet switch)?
    – derobert
    Jan 25, 2018 at 17:37

1 Answer 1


I would just bridge the two, in which case there will be no need for an IP address on tap0, i.e.;

brctl addif br0 tap0
ip link set tap0 master br0

or if you don't already have bridge-utils installed, then:

ip tuntap add tap0 mode tap
ip link set dev tap0 up
ip link add br0 type bridge
ip link set tap0 master br0
ip link set eth0 master br0

(configure the master, br0, with the IP address, the slaves will share it)

  • well if I bridge the 2 interfaces. then If a LAN/WAN packet came I never be able to see in my tap0 interface, right?
    – Mr. Nobody
    Jan 25, 2018 at 19:21
  • I am not sure how you are trying to capture packets, but perhaps it would work if you had something attached to tap0; a VM for instance.
    – Shōgun8
    Jan 25, 2018 at 20:09
  • All right did you read my question update, about why do I need a tap interface? so for that purpose am I gonna be able to use a bridged eth0 and tap0 interface ?
    – Mr. Nobody
    Jan 25, 2018 at 20:31
  • Did you try to bridge? tap0 should be reachable.
    – Shōgun8
    Jan 26, 2018 at 0:47
  • 2
    yep I bridged it but If I do a ping x.x.x.x -I tap0 it doesnt work, nor does eth0, just the bridge which is br0 works
    – Mr. Nobody
    Jan 26, 2018 at 10:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .