Linux specifies that a host or network is accessed from an IP
There are 3 IPs on test machine A
The eth0 192.168.1.34, respectively.
Eth0:1 192.168.1.36
Eth1 192.168.1.35
First boot on test machine B Apache Access_log
Tail-f/etc/httpd/logs/access_log
Then access B on test machine A, you can see
192.168.1.34--[26/aug/2014:02:54:24 +0800] "get/http/1.1" 403 4958 "-" "mozilla/5.0 (X11; Linux x86_64; rv:17.0) gecko/20131023 firefox/17.0 "
The default is from the first IP address of the first network card.
Then execute the route add-host 192.168.1.33 Dev Eth0:1 on a
Visit B again and you'll see
192.168.1.36--[26/aug/2014:02:50:10 +0800] "get/http/1.1" 403 4958 "-" "mozilla/5.0 (X11; Linux x86_64; rv:17.0) gecko/20131023 firefox/17.0 "
And then execute on a.
Route del-host 192.168.1.33 Dev eth0:1
Route add-host 192.168.1.33 Dev eth1
Visit B again and you'll see
192.168.1.35--[26/aug/2014:02:54:41 +0800] "Get/icons/apache_pb.gif http/1.1" 304-"http://192.168.1.33/" "MOZILLA/5 .0 (X11; Linux x86_64; rv:17.0) gecko/20131023 firefox/17.0 "
If you want to specify access to a segment of the network,
Route add-net 192.168.0.0/24 Dev eth0:1
If you want to go out from the specified gateway to a host
Route add-host 192.168.1.33 GW 192.168.1.1
If you don't have a browser when you test, you can also use Curl http://192.168.1.33
Linux specifies that a host or network is accessed from an IP