Skip to contentSkip to conversation

understanding TUN/TAP

DISCUSSION Grigory Batalov 1 participant 1 message Jan 14, 2004

lore
Share & tools
lore
#0 lore raw

Hi!

I try to check TUN/TAP packet driver functionality but some aspects are unclear to me. First, I made persistent device tap0 with tunctl from User Mode Linux. Then I created script /etc/sysconfig/network-scripts/ifcfg-tap0:

DEVICE=tap0
BOOTPROTO=static
IPADDR=192.168.57.15
NETMASK=255.255.255.0
NETWORK=192.168.57.0
BROADCAST=192.168.57.255
ONBOOT=yes
IPXNETNUM_802_2=00000003
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="yes"

So after "ifup tap0" I have:

$ /sbin/ifconfig
...
tap0      Link encap:Ethernet  HWaddr 00:FF:F7:35:8D:7D  
          inet addr:192.168.57.15  Bcast:192.168.57.255  Mask:255.255.255.0
          IPX/Ethernet 802.2 addr:00000003:00FFF7358D7D
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:193 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1121 errors:0 dropped:4298 overruns:0 carrier:0
          collisions:0 txqueuelen:100 
          RX bytes:11580 (11.3 Kb)  TX bytes:186105 (181.7 Kb)
$ /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.57.0    0.0.0.0         255.255.255.0   U     0      0        0 tap0
172.16.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         172.16.0.100    0.0.0.0         UG    0      0        0 eth0

In ~/.dosemurc :

$_pktdriver = (on)
$_netdev = "tap0"
$_vnet = "tap"

Also I got Waterloo TCP/IP utils:
http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/net/wattcp/wat2001b.zip
and made config for them (~/dosemu/freedos/net/tcp.cfg):

my_ip=192.168.57.14
netmask=255.255.255.0
gateway=192.168.57.15

Then in dosemu I start tcpinfo:

C:\NET>tcpinfo
Reading Waterloo TCP configuration file.

Ethernet Address : 64:62:a6:90:78:78

IP Address : 192.168.57.14
Network Mask : 255.255.255.0

Gateways : GATEWAY'S IP SUBNET SUBNET MASK

                 : 192.168.57.15    DEFAULT

Cookieserver : NONE DEFINED

Nameserver : NONE DEFINED

Domain : "(null)"

Ping from dosemu to Linux host goes well:

C:\NET>ping 192.168.57.15 2
Pinging [192.168.57.15] 2 times once per_second sent PING # 1 , PING receipt # 1 : response time 0.00 seconds sent PING # 2 , PING receipt # 2 : response time 0.00 seconds

C:\NET>ping 172.16.0.57 2
Pinging [172.16.0.57] 2 times once per_second
sent PING # 1 , PING receipt # 1 : response time 0.00 seconds sent PING # 2 , PING receipt # 2 : response time 0.00 seconds

But not from host to dosemu:

$ ping 192.168.57.14
PING 192.168.57.14 (192.168.57.14) 56(84) bytes of data.
From 192.168.57.15 icmp_seq=1 Destination Host Unreachable
From 192.168.57.15 icmp_seq=2 Destination Host Unreachable
From 192.168.57.15 icmp_seq=3 Destination Host Unreachable

If I start bridging between tap0 and eth0 then I even can't
ping host from dosemu:

$ sudo /sbin/brctl addbr br0
$ sudo /sbin/brctl addif br0 tap0
$ sudo /sbin/brctl addif br0 eth0

C:\NET>ping 192.168.57.15 2
Pinging [192.168.57.15] 2 times once per_second

PING: Cannot resolve host's hardware address

So my question is: where am I wrong and what also should be tuned?