You are not logged in.

#1 2010-05-02 20:06:07

AleXoundOS
Member
From: Russia
Registered: 2009-07-18
Posts: 31
Website

(Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

Hello. I have 2 computers and a printer.

computer[192.168.100.2] is running MacOSX and has an ethernet card
computer[192.168.100.3] is running ArchLinux 2.6.31 and has 2 interfaces: eth0 - ethernet and wlan0 is wireless (Marvell 99w9335 Libertas, uses ndiswrapper)
printer[192.168.100.17] is running an unknown OS and links via wifi
adsl router[192.168.100.1] has 4 ethernet ports, it acts here like a switch

I need to print from the computer[192.168.100.2]:
computer[100.2]{en0}  <--adsl router-->  {eth0}computer[100.3]{wlan0}  <-->  {wifi}printer[100.17]

I tried two methods:
1)routing
2)bridging

1)

modprobe ndiswrapper
iwconfig wlan0 mode Ad-Hoc essid "my_adhoc" channel 6
ifconfig wlan0 192.168.100.3 up
route add 192.168.100.17 wlan0

iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward
/etc/rc.d/iptables save
/etc/rc.d/iptables start

After adding a route to 192.168.100.17 in MacOSX I can ping the printer and access printer's web site.
But I can't print, probably because it uses some specific tcp ports (9100,9101,9102,9110,9220) and may be udp ports, which I can't access.
May be I need something like: iptables --append FORWARD --in-interface eth0 -j ACCEPT
2)

modprobe ndiswrapper
iwconfig wlan0 mode Ad-Hoc essid "my_adhoc" channel 6
ifconfig wlan0 192.168.100.3 up

brctl addbr mybridge
brctl addif mybridge eth0
brctl addif mybridge wlan0
ifconfig eth0 0.0.0.0 promisc up
ifconfig wlan0 0.0.0.0 promisc up
ifconfig mybridge 192.168.100.3 up

This variant looks more friendly and simple, but I can't here ping the printer from computer[100.2]. I noticed that when I try to ping from computer[100.2], printer receives the packets, but nothing returns to the sender.

Last edited by AleXoundOS (2010-05-02 20:12:29)

Offline

#2 2010-05-03 08:46:26

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

can u ping the printer from the bridged machine and the mac machine as well? also, in routed mode, if your default policy for FORWARD chain is ACCEPT, then you dont need to add any more rules to it.

can u print from the bridged machine?

Offline

#3 2010-05-04 21:39:39

AleXoundOS
Member
From: Russia
Registered: 2009-07-18
Posts: 31
Website

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

In the bridge mode I can ping the printer and the Mac machine. And the Mac machine pings the bridged machine as well, but not the printer. The most interesting thing for me is that when I ping the printer from Mac, the printer shows in it's stats that it receives the packets, but none of the pings return to the Mac.
I also can print from the bridged machine.

How to set default policy for FORWARD?

Last edited by AleXoundOS (2010-05-04 21:39:58)

Offline

#4 2010-05-05 05:55:21

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

in routed mode, your wireless interface ip and your printer must be in a different subnet that your ethernet ip addresses so that the routing tables are not confused, try setting them both to ip address 192.168.101.4 192.168.101.17, but keep your ethernet ip's the same and then try NAT'ing them.
as for bridged mode, have you checked whether the printer can ping hosts on your ethernet segment?

iptables -P FORWARD ACCEPT

Offline

#5 2010-05-05 08:56:29

AleXoundOS
Member
From: Russia
Registered: 2009-07-18
Posts: 31
Website

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

Thank you for replies.

In routed mode:
Setting wlan0 to other ip address(even in the same subnet) and adding "iptables -P FORWARD ACCEPT" plus reinstalling the printer in CUPS solved the problem in routed mode.

In bridge mode:
It is impossible to check whether the printer can ping hosts on my ethernet segment, because I don't know how to access it's OS (telnet and ssh don't work). The web site does not provide ping utility, just stats about packets transfers and wireless interface configuration. nmap shows:

80/tcp   open  http
9100/tcp open  jetdirect
9101/tcp open  jetdirect
9102/tcp open  jetdirect
9110/tcp open  unknown
9220/tcp open  unknown
MAC Address: 00:25:B3:FD:A3:91 (Hewlett Packard)
Device type: printer
Running: HP embedded
OS details: HP Photosmart C4380, J6400-series, C7200-series, or D7260 printer

137/udp   open|filtered netbios-ns
161/udp   open|filtered snmp
427/udp   open|filtered svrloc
3702/udp  open|filtered unknown
5353/udp  open|filtered zeroconf
9103/udp  open|filtered unknown
32770/udp open|filtered sometimes-rpc4
32773/udp open|filtered sometimes-rpc10
MAC Address: 00:25:B3:FD:A3:91 (Hewlett Packard)
Device type: power-device|specialized|VoIP gateway|security-misc|printer|media device
Running: APC AOS 2.X|3.X, APC embedded, AudioCodes embedded, Bosch embedded, Digi NET+OS 7, HP embedded, Brother embedded, Motorola embedded

Last edited by AleXoundOS (2010-05-05 09:29:05)

Offline

#6 2010-05-05 10:59:07

Sin.citadel
Member
Registered: 2008-01-22
Posts: 267

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

after searching google, i found that the wlan bridge does not work for ad-hoc network,you should set your wireless device in master mode (if it is supported by the hardware) and then check the bridge.

Offline

#7 2010-05-06 09:39:53

AleXoundOS
Member
From: Russia
Registered: 2009-07-18
Posts: 31
Website

Re: (Ethernet <--> WiFi <--> Printer) Problem, routing or bridging fails.

I think too, that the problem is in wireless adapter. I'm not able to change the mode other than Managed or Ad-Hoc, because of using ndiswrapper, after googling:

NDIS doesn't support Master/Repeater/Monitor modes. The only modes supported are Ad-Hoc and Managed. Note that some drivers may support features that are not in NDIS e.g., showing signal noise and possibly Master mode, but they are proprietary and no documentation available for them, so such features won't be supported by ndiswrapper.

In addition I remember in windowsxp the adapter didn't have Master mode too. Also I'm not sure that ndiswrapper works well with bridging.
So I will use routed mode.

Last edited by AleXoundOS (2010-05-06 09:51:43)

Offline

Board footer

Powered by FluxBB