You are not logged in.
Here is the setup that I would like to achieve. I have two computers A and B. A and B are connected wirelessly to the net. I would like also to connect the computers A and B with an ethernet cable and that any connection between the two computers go through the cable. The route between A and B should direct without gateway. It must be somewhat trivial but I a am lost with the ip command. If someone could post the two or three lines necessary to achieve this, it would help me a lot.
Last edited by olive (2012-06-08 12:50:45)
Offline
Post what you've tried so far, and the results (or lack of them). The routing table from both boxes would also be useful.
Offline
OK, I have succeeded but I am not a specialist in configuring network =, I do not know if my solution is clean at all.
First simply connect wirelesly to the router on both ends, dhcpcd is used.
Computer A gives:
[root@pcolivier ~]# ip route show
default via 192.168.1.1 dev wlan0 metric 303
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.10 metric 303
[root@pcolivier ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 metric 1
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 79 bytes 6911 (6.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 79 bytes 6911 (6.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:19:db:04:4c:2a txqueuelen 1000 (Ethernet)
RX packets 5458 bytes 4187435 (3.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4209 bytes 691878 (675.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Computer B is the same exept that it gets the address 192.168.1.11. Now I simply add the address 10.10.10.2 to the interface eth0 on computer A (and 10.10.10.3 on computer B).
ifconfig eth0 10.10.10.2
This gives:
[root@pcolivier ~]# ip route show
default via 192.168.1.1 dev wlan0 metric 303
10.0.0.0/8 dev eth0 proto kernel scope link src 10.10.10.2
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.10 metric 303
[root@pcolivier ~]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1
inet 10.10.10.2 netmask 255.0.0.0 broadcast 10.255.255.255
ether 00:03:0d:5a:91:7a txqueuelen 1000 (Ethernet)
RX packets 32207 bytes 36348619 (34.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 24521 bytes 3312039 (3.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 16
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 metric 1
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 0 (Local Loopback)
RX packets 79 bytes 6911 (6.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 79 bytes 6911 (6.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1
inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255
ether 00:19:db:04:4c:2a txqueuelen 1000 (Ethernet)
RX packets 5589 bytes 4227039 (4.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4209 bytes 691878 (675.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now I cannect from A to B with the address 10.10.10.3 through the cable (checked by physically disabling the wireless interface). I am still somewhat uncomfortable because I have the feeling I not understand all of this. For example I am not sure that I have to use two IP adresses by computer (here each network card has its own address).
Offline
Yes, that's correct. You need a distinct address for each interface, and a separate subnet for each network. In this case, your wifi is on the 192.168.1.x subnet, and the wired net is on the 10.0.0.x subnet.
You may not be concerned about this, but you could also use ip instead of ifconfig to configure the additional interfaces. ifconfig still works, but it is deprecated in favour of ip. Of course, if you want all this to be persistent, then you can use netcfg/wicd/networkmanager/etc to automate it.
Offline
OK, I understand better. I know that ifconfig is depreceated but it is what I knew and I was in a hurry to try out but I will learn ip. Usually I prefer to make things persistent by writing customs scripts but I can still see netcfg. I put this thread as solved.
Offline