bridging wlan0 to eth0 in wicd

You have a problem with Salix? Post here and we'll do what we can to help.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

bridging wlan0 to eth0 in wicd

Post by jsfarinet »

I want to share, ocasionally, the existing internet connection done by wifi (wlan0) to another computer using the ethernet (eth0). But i don't see an easy way to do that with wicd (?) May be i'm missing something.

Googling a bit gave me some infos which are more or less commandline oriented (some editing of dhcp conf files etc.). The best seemed to me the debian wiki bridging. In any case i tried their suggestions (i also installed bridge-utils). But i could not add wlan0 to the created bridge (like they suggested i called it br0).

I hesitate a bit to change in deep the config files in /etc/ because i do not want to break something. Actually, the best would be a simple way to share the connection "on the fly" with wicd ;)

Thanks in advance for any help!
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: bridging wlan0 to eth0 in wicd

Post by zAchAry »

In case you get no answer here, try at https://answers.launchpad.net/wicd
Image
Help to make Slackware easier Donate to Salix
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: bridging wlan0 to eth0 in wicd

Post by jsfarinet »

zAchAry wrote:In case you get no answer here, try at https://answers.launchpad.net/wicd
Thanks for the hint. I did a quick research but did not find anything (or better: 2 questions, expired because there were no reply) :-(

A small footnote: I remember - with wicd - i succeeded once (long time ago) in sharing a wireless connection with (on laptop running debian) by ethernet (to a Macintosh). So, i think there will be a way ...
User avatar
gapan
Salix Wizard
Posts: 6244
Joined: 6. Jun 2009, 17:40

Re: bridging wlan0 to eth0 in wicd

Post by gapan »

I don't think wicd supports that.

The instructions you have should probably work though. If you could point to them, maybe we could find what's wrong.

Don't be afraid of editing the configuration files in /etc. You could always make a backup before editing, which you could restore if anything goes wrong.

Code: Select all

sudo cp /etc/example /etc/example.bak
Another possibility would be to replace wicd with NetworkManager. You'll also need the network-manager-applet package of course. I think that includes functionality for sharing connections (but haven't confirmed or ever used it myself).
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: bridging wlan0 to eth0 in wicd

Post by jsfarinet »

Thanks to you gapan. I'll try.

Another way would be to use "ceni" (a commandline tool created by the aptosid people, which i like a lot - and would love to be able use it with Salix. Look here: http://www.linux.org/threads/ceni.7668/). There is a tar.xz file, but i do not know how to make it "slackware friendly" ... (?)
User avatar
gapan
Salix Wizard
Posts: 6244
Joined: 6. Jun 2009, 17:40

Re: bridging wlan0 to eth0 in wicd

Post by gapan »

Well, here's a package: http://pnboy.pinguix.com/gapan/salix/ceni/

But, it won't work just like that. It has several (it seems) perl dependencies which you'll need to install first. It needs at least Expect and Pty, maybe more... You can try installing them with cpan, for example:

Code: Select all

cpan Expect
(the first time you run cpan there will also be some configuration steps).
and then try to launch it from a terminal:

Code: Select all

sudo Ceni
see if you get any error messages for missing modules and install them the same way.

Not sure it's worth all the trouble.
Image
Image
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: bridging wlan0 to eth0 in wicd

Post by laprjns »

Seems that it only needs Expect to run, but the bad news is that Ceni seems to be written for Debian and will not work on Slackware. Ceni tries to read the interfaces file in the /etc/neworks directory, which doesn't exist in slackware base distro.

Image
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: bridging wlan0 to eth0 in wicd

Post by jsfarinet »

laprjns wrote:Seems that it only needs Expect to run, but the bad news is that Ceni seems to be written for Debian and will not work on Slackware. Ceni tries to read the interfaces file in the /etc/neworks directory, which doesn't exist in slackware base distro.

Image
That's correct: It's an Aptosid program. Ok, i understand. It's a pity but it's like this ;) :-(

Thanks to you both, for helping! Tomorrow i'll try the wicd way ;)
djemos
Salix Warrior
Posts: 1433
Joined: 29. Dec 2009, 13:45
Location: Greece

Re: bridging wlan0 to eth0 in wicd

Post by djemos »

This is called masquerade. I have used this, many years before, to share a dial-up to another pc connected with a crossover cable.

My laptop is connected wireless on internet.
I want to share my connection to the other pc.
I used a dedicated switch where i connect both my laptop and my pc. This has been tested.
Or can use a crossover cable to connect laptop and pc. I have not checked this.

On LAPTOP which is connected to internet with wireless
1. Create a file masq.sh and add the following exactly, in the end of file.

Code: Select all

#!/bin/sh
#
#Share my wireless connection to eth0
#Assuming wlan0 is your wireless WAN port, e.g. the laptop) and eth0 is your LAN port e.g your client PC
#and that you have connected your client PC to your host PC Laptop via a dedicated switch or (with a crossover ethernet cable)

ifconfig eth0 down
ifconfig eth0 192.168.10.1 netmask 255.255.255.0
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

iptables -F FORWARD
iptables -A FORWARD -j ACCEPT
iptables -nvL

2.
install dnsmasq so your client pc should take an address using dhcp. So you can share your wireless connection to many pc's. In a common switch can use 7 pc's.

Code: Select all

sudo slapt-get -i dnsmasq
3. Edit the file /etc/dnsmasq.conf

Code: Select all

sudo geany /etc/dnsmasq.conf 
and add these lines in the end.

Code: Select all

interface=eth0
dhcp-range=192.168.10.10,192.168.10.19,4h
4. start the dnsmasq

Code: Select all

sudo service start dnsmasq
On every boot just type on laptop

Code: Select all

sudo sh masq.sh
on client pc type for testing. ( this not need on every boot of client pc. It will pick up an ip from dhcpcd)

Code: Select all

sudo dhcpcd 
Open a browser on client pc and you are on internet.

On my laptop typing the command sudo route i get

Code: Select all

djemos[~]$ sudo route
Password: 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         dsldevice.lan   0.0.0.0         UG    0      0        0 wlan0
loopback        *               255.0.0.0       U     0      0        0 lo
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.10.0    *               255.255.255.0   U     0      0        0 eth0
On client pc

Code: Select all

djemos[~]$ sudo route
Password: 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.10.1    0.0.0.0         UG    202    0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
192.168.10.0    *               255.255.255.0   U     202    0        0 eth0

Code: Select all

djemos[~]$ ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
       inet 192.168.10.16  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::6ab5:99ff:fe66:a8c  prefixlen 64  scopeid 0x20<link>
        ether 68:b5:99:66:0a:8c  txqueuelen 1000  (Ethernet)
        RX packets 3063  bytes 2232352 (2.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2891  bytes 325686 (318.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Code: Select all

djemos[~]$ cat /etc/resolv.conf 
# Generated by dhcpcd from eth0.dhcp
# /etc/resolv.conf.head can replace this line
nameserver 192.168.10.1
# /etc/resolv.conf.tail can replace this line
Of cource can use wicd on client pc. It will pick up an ip from wired net.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: bridging wlan0 to eth0 in wicd

Post by jsfarinet »

Wow,impressive. Thanks a lot.

Just a question regard the range: Is it necessary to give to the guest (the pc connected to the laptop with the i-net connection) a different net than that running between laptop and gateway/router? In your example, as i understand, your local net to the router runs as 192.168.1.* and the net given to the guest (by dnmasquerade) is 192.168.10.* Correct?

Would the connected pc pick up the line without any explicite configuration? (In my case i'd like to share the line, to install a *bsd on an old hp laptop where the built-in wifi is not working out of the box).

Finally, should i make the masq.sh file executable? And, why should i call it by sudo, when it is a local (user related file)? Because the instructions in it need superuser power?

As for the rest,seems clear to me.
Post Reply