Article 5N35K internal vlan address

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:
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
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:
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
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:
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
any inputs will be appreciatedlatest?d=yIl2AUoC8zA latest?i=qwuvygsMm1Q:BgptQbGC56w:F7zBnMy latest?i=qwuvygsMm1Q:BgptQbGC56w:V_sGLiP latest?d=qj6IDK7rITs latest?i=qwuvygsMm1Q:BgptQbGC56w:gIN9vFwqwuvygsMm1Q
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments