Hi,
I'm trying to set up a test bed where I can use a single machine to do some network packet captures between 2 different applications without needing a network connection.
I'm actually trying to do some SIP VoIP development, but for illustration purposes will use ping. I want:
ping 127.0.0.1 (will send a packet dest: 127.0.0.1, src: 127.0.0.2)
(the reply will be dest: 127.0.0.2, src: 127.0.0.1)
Except I DON'T want to use the -I option.
I have figured out how to add the addresses to lo:
/etc/network/interfaces:
Code:
auto lo
iface lo inet loopback
auto lo:0
allow-hotplug lo:0
iface lo:0 inet static
address 127.0.0.2
netmask 255.0.0.0
This works.
However, whenever I try to use these addresses as sources in the iproute2 command there appears to be something overriding my routes:
Code:
sudo ip route replace local 127.0.0.1 dev lo table local scope host src 127.0.0.2 proto static
sudo ip route replace local 127.0.0.2 dev lo table local scope host src 127.0.0.1 proto static
rich@adventure:~$ ip route show table local
broadcast 192.168.0.255 dev eth0 proto kernel scope link src 192.168.0.2
broadcast 192.168.0.255 dev wlan0 proto kernel scope link src 192.168.0.6
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 172.16.250.255 dev vmnet1 proto kernel scope link src 172.16.250.1
broadcast 172.16.226.255 dev vmnet8 proto kernel scope link src 172.16.226.1
broadcast 192.168.0.0 dev eth0 proto kernel scope link src 192.168.0.2
broadcast 192.168.0.0 dev wlan0 proto kernel scope link src 192.168.0.6
broadcast 172.16.250.0 dev vmnet1 proto kernel scope link src 172.16.250.1
local 192.168.0.2 dev eth0 proto kernel scope host src 192.168.0.2
local 172.16.250.1 dev vmnet1 proto kernel scope host src 172.16.250.1
broadcast 172.16.226.0 dev vmnet8 proto kernel scope link src 172.16.226.1
local 127.0.0.2 dev lo proto static scope host src 127.0.0.1
local 172.16.226.1 dev vmnet8 proto kernel scope host src 172.16.226.1
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 192.168.0.6 dev wlan0 proto kernel scope host src 192.168.0.6
local 127.0.0.1 dev lo proto static scope host src 127.0.0.2
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
rich@adventure:~$ ip route get 127.0.0.1
local 127.0.0.1 dev lo src 127.0.0.1
cache <local> mtu 16436 advmss 16396 hoplimit 64
rich@adventure:~$ ip route get 127.0.0.2
local 127.0.0.2 dev lo src 127.0.0.2
cache <local> mtu 16436 advmss 16396 hoplimit 64
rich@adventure:~$ sudo ip route del 127.0.0.0/8 table local
rich@adventure:~$ ip route show table local
broadcast 192.168.0.255 dev eth0 proto kernel scope link src 192.168.0.2
broadcast 192.168.0.255 dev wlan0 proto kernel scope link src 192.168.0.6
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
broadcast 172.16.250.255 dev vmnet1 proto kernel scope link src 172.16.250.1
broadcast 172.16.226.255 dev vmnet8 proto kernel scope link src 172.16.226.1
broadcast 192.168.0.0 dev eth0 proto kernel scope link src 192.168.0.2
broadcast 192.168.0.0 dev wlan0 proto kernel scope link src 192.168.0.6
broadcast 172.16.250.0 dev vmnet1 proto kernel scope link src 172.16.250.1
local 192.168.0.2 dev eth0 proto kernel scope host src 192.168.0.2
local 172.16.250.1 dev vmnet1 proto kernel scope host src 172.16.250.1
broadcast 172.16.226.0 dev vmnet8 proto kernel scope link src 172.16.226.1
local 127.0.0.2 dev lo proto static scope host src 127.0.0.1
local 172.16.226.1 dev vmnet8 proto kernel scope host src 172.16.226.1
broadcast 127.0.0.0 dev lo proto kernel scope link src 127.0.0.1
local 192.168.0.6 dev wlan0 proto kernel scope host src 192.168.0.6
local 127.0.0.1 dev lo proto static scope host src 127.0.0.2
rich@adventure:~$ sudo ip route flush table cache
rich@adventure:~$ ip route get 127.0.0.1
local 127.0.0.1 dev lo src 127.0.0.1
cache <local> mtu 16436 advmss 16396 hoplimit 64
rich@adventure:~$ ip route get 127.0.0.2
local 127.0.0.2 dev lo src 127.0.0.2
cache <local> mtu 16436 advmss 16396 hoplimit 64
And doing a packet capture confirms the results of "ip route get"
I read somewhere that the "src" is only a "hint" to the kernel. Is there a way to make it strict!?
Any help would be much appreciated!
Hello
I have a question about routing in MANET using Dynamic Source Routing protocol.
IN RFC4728 (DSR) in section "IP fields" of RREP (Route Reply) packet we have this:
ok.
I read in several books and also in rfc4728 that: when a source node (node that initiate route discovery process)... (1 Reply)
clear
echo "vans, Rolland"
echo "Press in Your Keyboard to Quit"
echo -e "Please Enter Your Choice : \c"
read option
case $option in
I have created the corresponding information for each input on the display so...
My question is...
How do I display the corresponding information... (6 Replies)
This is in the beginning of the program:
clear
tput cup 1 20
echo "Welcome to UNIX I Final Assignment"
tput cup 4 3
echo -e "Who would you like to look up? \c"
tput cup 6 5
echo "vans, Rolland"
tput cup 8 5
echo "ones, Mildred"
tput cup 10 5
echo "mith, Julie"
tput cup 12 5
echo... (0 Replies)
Hi all,
I am new to linux routing and would like to keep a possible running dialog about some scripts I have been studying and what the different parts of them mean. We are using Openwrt backfire along with openvpn and Swyx as VoIP. My goal is to eventually implement some QoS using dsmark, but... (1 Reply)
I have seen a lot of IPv4/IPv6 address manipulation libraries but I have yet to see a library allowing you to manipulate the interfaces/addresses/routes.
Anybody else have any experience finding an iproute2 equivalent for Python?
My basic requirements are the ability to add/remove addresses,... (1 Reply)
Hi all,
I have some doubts in selecting the interface to transfer packets and receive the packets.
--> Multiple interfaces :
--------------------
1) 0.0.0.0 --------> wild card address.
2) x.x.x.x --------> valid address.(192.168.1.156)
3) ff.ff.ff.ff -------->... (0 Replies)
I have checkpoint firewall-1 running on a solaris 7 sparc box with two physical working networks interface cards hme0, qfe0,
(please note these are false addresses)
qfe0 = 195.111.222.178 internet ISP
hme0 = 172.19.12.58 /24 internal Lan which has a router to france on it
I want to... (3 Replies)
Recently I noticed that my internet connection would not work correctly-although connected domain names could not be resolved. My resolv.conf file was fine since it is configured every time I dial up. a closer inspection showed that my loopback interface had disappearerd! Any ideas why would this... (1 Reply)
Hi, does anybody know how to set the IP source address of an IP packet to be zero? The problem is that when you create a raw socket and set the IP_HDRINCL socket option, if you put the ip_src address to zero (INADDR_ANY) the kernel will automatically set the source address to the primary IP address... (2 Replies)