How connect just through single veth
by Daniil Iaitskov from LinuxQuestions.org on (#5EGFH)
I created a cable with 2 interfaces and assigned to address them. Server is bound one interface, while client connects through the other. As for now cable abstraction in veth leaks for me, because following setup should work. Client connects to 192.168.1.2 but sends packets via 192.168.1.1.
Code:$ ip link add v1 type veth peer name v2
$ ip address add 192.168.1.2 dev v2
$ ip address add 192.168.1.1 dev v1
$ ip link set v1 up
$ ip link set v2 up
$ nc -tln 192.168.1.2 -p 8888
# other terminal
$ echo hello | nc -s 192.168.1.1 192.168.1.2 8888
# server on the first terminal prints error
invalid connection to [192.168.1.2] from (UNKNOWN) [192.168.1.1] 37483What did I miss?
I have routes:
Code:$ ip r g 192.168.1.1 from 192.168.1.2
local 192.168.1.1 from 192.168.1.2 dev lo uid 1000
cache <local>
$ ip r g 192.168.1.2 from 192.168.1.1
local 192.168.1.2 from 192.168.1.1 dev lo uid 1000
cache <local>


Code:$ ip link add v1 type veth peer name v2
$ ip address add 192.168.1.2 dev v2
$ ip address add 192.168.1.1 dev v1
$ ip link set v1 up
$ ip link set v2 up
$ nc -tln 192.168.1.2 -p 8888
# other terminal
$ echo hello | nc -s 192.168.1.1 192.168.1.2 8888
# server on the first terminal prints error
invalid connection to [192.168.1.2] from (UNKNOWN) [192.168.1.1] 37483What did I miss?
I have routes:
Code:$ ip r g 192.168.1.1 from 192.168.1.2
local 192.168.1.1 from 192.168.1.2 dev lo uid 1000
cache <local>
$ ip r g 192.168.1.2 from 192.168.1.1
local 192.168.1.2 from 192.168.1.1 dev lo uid 1000
cache <local>