network interface by default in debian


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/code-flow.club/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
5 views
Hello,
sorry for the noob question.
I have such network interfase:

eth1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:55
inet addr:yyy.yyy.yyy.84 Bcast:yyy.yyy.yyy.255 Mask:255.255.255.0
inet6 addr: --clean-- Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1464826259 errors:0 dropped:0 overruns:0 frame:0
TX packets:1164216652 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1150228826 (1.0 GiB) TX bytes:1092735623 (1.0 GiB)
Interrupt:215 Base address:0x6000

eth1:0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:55
inet addr:yyy.yyy.yyy.85 Bcast:yyy.yyy.yyy.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:215 Base address:0x6000

eth1:1 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:55
inet addr:yyy.yyy.yyy.86 Bcast:yyy.yyy.yyy.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:215 Base address:0x6000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:451764543 errors:0 dropped:0 overruns:0 frame:0
TX packets:451764543 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2821705653 (2.6 GiB) TX bytes:2821705653 (2.6 GiB)

If I type "wget internet.yandex.ru" in the console, then pumped the page with the address yyy.yyy.yyy.86. How to make so that by default the request was via eth1 (yyy.yyy.yyy.84)?
by | 5 views

4 Answers

0 like 0 dislike
purely for wget has the option
--bind-address=ADDRESS bind to ADDRESS (hostname or IP) on the local host.
you can settle in wgetrc
also have for ping and some other tools for the network. but globally the same routing.
by
0 like 0 dislike
To make eth1 the default one. Well, or IP addresses to change on the interfaces.
by
0 like 0 dislike
in General, what is the interface last went up, and dadacts as the default outgoing. Temporary solution to do so:
\r
ifconfig eth1 up yyy.yyy.yyy.84 netmask 255.255.255.0 

Constantly the solution: either put this in a startup script or long shaman, I'm too lazy to Google how.
by
0 like 0 dislike
can earn:
\r
ip route replace default dev eth1 src yyy.yyy.yyy.84
\r
or this:
iptables-t nat -A POSTROUTING -o eth1 -j SNAT --to-source yyy.yyy.yyy.84
by
110,608 questions
257,186 answers
0 comments
22,148 users