internal vlan address
by guy_sarav from LinuxQuestions.org on (#5N35K)
hi,
i have a external ip address on my machine on eth0 interface 172.16.81.155.
i have created a dummy interface eth0:2 and assigned 173.1.1.2
i run a server application by opening a socket binding to 173.1.1.2
i setup iptables rules as below:
Quote:
now from another PC, which has ip address of 172.16.81.13 i run a client program to connect to 172.16.81.155 ip.
above works fine.
i remove this dummy eth0:2 interface and replace with a vlan interface eth0.2 by below commands:
Quote:
and on the peer end i create a vlan with id 2.
then if i run server and client programs, it doesnt work.
tcpdump:
Quote:
any inputs will be appreciated
i have a external ip address on my machine on eth0 interface 172.16.81.155.
i have created a dummy interface eth0:2 and assigned 173.1.1.2
i run a server application by opening a socket binding to 173.1.1.2
i setup iptables rules as below:
Quote:
echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 49155 -j DNAT --to-destination 173.1.1.2 iptables -t nat -A POSTROUTING -o eth0 -p tcp --dport 49155 -d 173.1.1.2 -j SNAT --to-source 170.1.1.2 iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -d 173.1.1.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -p icmp --icmp-type 0 -s 173.1.1.2 -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A OUTPUT -p icmp --icmp-type 8 -s 173.1.1.2 -d 0/0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT iptables -A INPUT -p icmp --icmp-type 0 -s 0/0 -d 173.1.1.2 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t raw -I PREROUTING -d 173.1.1.2 -j DROP |
above works fine.
i remove this dummy eth0:2 interface and replace with a vlan interface eth0.2 by below commands:
Quote:
ip link add link eth0 name eth0.2 type vlan id 2 ip link ip -d link show eth0.2 ip link set dev eth0.2 up sleep 1 ifconfig eth0.2 173.1.1.2 up |
then if i run server and client programs, it doesnt work.
tcpdump:
Quote:
20:44:54.968921 IP 172.16.81.13.49155 > 172.16.81.155.49155: Flags [S], seq 46399127, win 64240, options [mss 1460,sackOK,TS val 3169100 ecr 0,nop,wscale 7], length 0 20:44:54.969009 IP 172.16.81.155.49155 > 172.16.81.13.49155: Flags [R.], seq 0, ack 46399128, win 0, length 0 20:44:56.026205 IP 172.16.81.13.49155 > 172.16.81.155.49155: Flags [S], seq 46399127, win 64240, options [mss 1460,sackOK,TS val 3170157 ecr 0,nop,wscale 7], length 0 |