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.
/etc/network/interfaces:
auto lo
iface lo inet loopback
allow-hotplug eth0
auto eth0
iface eth0 inet static
address 192.168.1.152
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-server 192.168.1.1
allow-hotplug tap0
auto tap0
iface tap0 inet manual
pre-up ip tuntap add tap0 mode tap user root
pre-up ip addr add 192.168.1.153/24 dev tap0
up ip link set dev tap0 up
post-up ip route del 192.168.1.0/24 dev tap0
post-up ip route add 192.168.1.152/32 dev tap0
post-down ip link del dev tap0
ifconfig
inet addr:192.168.1.152 bcast:192.168.1.255 netmask 255.255.255.0
lo:
inet addr:127.0.0.1 mask 255.0.0.0
tap0:
inet addr: 192.168.1.153 bcast:0.0.0.0 mask 255.255.255.0
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?