Tag Info

Hot answers tagged

30

Newer versions of scp have the option -3 -3 Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts


19

"IP forwarding" is a synonym for "routing." It is called "kernel IP forwarding" because it is a feature of the Linux kernel. A router has multiple network interfaces. If traffic comes in on one interface that matches a subnet of another network interface, a router then forwards that traffic to the other network interface. So, let's say you have two NICs, ...


17

You can use route to find your default route: $ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.1.0 * 255.255.255.0 U 1 0 0 eth0 link-local * 255.255.0.0 U 1000 0 0 eth0 default 192.168.1.1 0.0.0.0 ...


17

echo 200 isp2 >> /etc/iproute2/rt_tables ip rule add from <interface_IP> dev ppp0 table isp2 ip route add default via <gateway_IP> dev ppp0 table isp2 The above doesn't require any packet marking with ipfilter. It works because the outgoing (reply) packets will have the IP address that was originally used to connect to the 2nd interface ...


17

It's not the ssh client that decides through which interface TCP packets should go, it's the kernel. In short, SSH asks the kernel to open a connection to a certain IP address, and the kernel decides which interface is to be used by consulting the routing tables. (The following assumes you're on GNU/Linux; the general concept is the same for all Unices, ...


12

After extensive study of the openvpn manual, I have found an answer for my question: I you don't want the routes to be executed automatically, but to be handled by your own tool, use the following option: --route-noexec Don't add or remove routes automatically. Instead pass routes to --route-up script using environmental variables. If you ...


12

You're close. The actual reason that the application isn't seeing the return traffic is because of the kernel's built in IP spoofing protection. I.e., the return traffic doesn't match the routing table and is therefore dropped. You can fix this by turning off spoofing protection like this: sudo sysctl net.ipv4.conf.wlan0.rp_filter=0 But I wouldn't ...


12

0.0.0.0 has the specific meaning "unspecified". This roughly translates to "there is none" in the context of a gateway. Of course, this means that the network is locally connected, as there is no next hop. As a destination, 0.0.0.0/0 is special: if there are no network bits, there can't be anything in the network number either. So, it's naturally ...


10

There are several possibilities, depending on how you want to decide what packets go where. Most of them will require some understanding of how TCP/IP networking works in Linux. The main tools you'll have to know to do complex things are iptables (Ubuntu: iptables ) and iproute2 (ip command) (Ubuntu: iproute , iproute-doc ). If you can discriminate fully by ...


10

Here is a similar setup from one of our routers (with some irrelevant stuff snipped). Note that this handles incoming connections as well. Note the use of variables instead of hard-coded mark numbers. So much easier to maintain! They're stored in a separate script, and sourced in. Table names are configured in /etc/iproute2/rt_tables. Interface names are ...


9

If you use ip instead of route, you could simply run: ip route del 0/0 I believe that catches all default routes.


8

You need to set the promote_secondaries option on the interface, or on all interfaces: echo 1 > /proc/sys/net/ipv4/conf/eth0/promote_secondaries or sysctl net.ipv4.conf.eth0.promote_secondaries=1 Change eth0 to all to have it work on all interfaces. This option has been in since 2.6.12. I tested this with a dummy interface and it worked there.


8

No packets are received for several seconds and then ~6 are sent back in quick succession. This is symptomatic of two similar phenomena: network congestion or network discards (usually due to congestion). In the first case, a router between here and there has a burst of traffic unrelated to your activities which cause your traffic to be buffered in ...


8

route del default route add default 1.2.3.4 Where 1.2.3.4 is the new gateway. You can even concatenate them onto the same line with a ; Edit: This is FreeBSD, not Linux. The command is different. Please do not edit this Answer if you haven't read the Question carefully enough to determine the operating system being used.


8

From the wikipedia page, 0.0.0.0 excerpt In the Internet Protocol version 4 the address 0.0.0.0 is a non-routable meta-address used to designate an invalid, unknown or non applicable target. To give a special meaning to an otherwise invalid piece of data is an application of in-band signaling. From the wikipedia page, Default Route. excerpt ...


8

If you need more flexibility than scp -3, plain ssh and pipes are fun. This is equivalent to redirecting the stream over the local machine: ssh sourceRemote 'cat /path/to/sourceFile' \ | ssh destinationRemote 'cat > /path/to/destinationFile' You can then add more stream redirections at any point, to e.g. chain several intermediate machines, or save a ...


7

To build up on @jsbillings's solution, repeat the command until it fails: while ip route del default; do :; done


6

The following commands create an alternate routing table via eth1 for packets that have the mark 1 (except packets to localhost). The ip command is from the iproute2 suite (Ubuntu: iproute , iproute-doc ). ip rule add fwmark 1 table 1 ip route add 127.0.0.0/0 table 1 dev lo ip route add 0.0.0.0/0 table 1 dev eth1 The other half of the job is recognizing ...


6

You could set up two virtual machines on the physical machine, and set up the network interface bridging so that one VM uses eth0 and the other VM uses eth1. See the virtual box documentation section on bridged networking.


6

The Linux Advanced Routing & Traffic Control HOWTO has a section describing to solve the problem. The key step to balance traffic between the two routes is to give them both a weight. ip route add default scope global \ nexthop via 192.168.0.1 dev eth1 weight 1 \ nexthop via 192.168.1.1 dev eth0 weight 1


6

For a simple router, there are really only two steps that need to be done. Enable routing The first step is to enable routing in the kernel. By default, the kernel drops packets that it doesn't recognize; once you enable routing, it'll forward them. You need to issue either of these two commands when the computer boots: sysctl -w net.ipv4.ip_forward=1 ...


6

This /etc/network/interfaces works for me on 2.6.32-40 Ubuntu 10.04 LTS: auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.254 post-up route add default gw 192.168.1.1 metric 1 pre-down route del default gw 192.168.1.1 auto eth1 iface ...


6

It's pretty easy. You need to connect PC to notebook. Configure eth0 on PC (set for example ip = 192.168.2.3 and default gateway 192.168.2.2 and dns server to 8.8.8.8). That's all you need to do on PC. On notebook you need to set up the internet connection as usual and configure eth0 with the following way: set ip address to 192.168.2.2, enable net ...


6

There are several settings which control this behavior. In short the solution is: sysctl -w net.ipv4.conf.eth0.arp_announce=2 sysctl -w net.ipv4.conf.eth1.arp_announce=2 sysctl -w net.ipv4.conf.eth0.arp_filter=1 sysctl -w net.ipv4.conf.eth1.arp_filter=1 sysctl -w net.ipv4.conf.eth0.arp_ignore=1 sysctl -w net.ipv4.conf.eth1.arp_ignore=1 The kernel ...


5

You'll want to use the iptables owner module and perhaps some clever packet mangling. owner This module attempts to match various characteristics of the packet creator, for locally-generated packets. It is only valid in the OUTPUT chain, and even then some packets (such as ICMP ping responses) may have no owner, and hence never match. ...


5

You can share the internet by configuring the Cent OS server as a NAT machine and giving private ip addresses to the LAN machines. As in your case, the USB wireless interface is ppp0 and the LAN interface is eth0 on the Cent OS server. Step-1: Providing private ip addresses to LAN interface on Cent OS and to the other machines in the LAN. You can give any ...


5

It maps to RTF_EXPIRES. It means the route has a non-infinite lifetime. In this case, the kernel probably learned the route dynamically from a RA (Router Advertisement). I recommend you use ip instead of route (and instead of ifconfig). Although it's Linux-specific and unportable, its syntax is much less archaic than the legacy commands. ip -6 route would ...


5

Well - this IS a routing-question. The answer is simple: The first entry that will give the best routing-entry is "the winner". So look at netstat -rn to see which interface is first. Update: The network-inferface-routing-settings normally get set up during system startup. So the startup order of network devices will be the order in that table. With ...


5

Note: I only have considered the first script, ignoring the old one. You don't need to modprobe netfilter modules by hand with current iptables. This is only necessary for custom connection trackers. Don't mix up route and ip route. This is pure evil. Just use ip everywhere and forget about ifconfig and route /etc/iproute2/rt_tables is not reset across ...


5

My question is: Why is it possible for a computer on the 172.16.2.0/24 subnet to ping 172.16.1.1 (ip address of eth1 interface)? Because you allowed it, and Linux does it by default. Linux uses what is called a weak host model. That mean when it receives a packet coming from eth2, it will consider the packet to be for him if the destination address is ...



Only top voted, non community-wiki answers of a minimum length are eligible