What wireless mode for a OpenWrt worked as printer server

I just installed openwrt17.x into my tl-wr720N. I could remote login it with lan port by ssh. my object is to connect my usb printer to the tl-wr720N. computers connected to another main WIFI router in home could use this tcpip 9100 printer. and tl-wr720N connect to the main router by WIFI only. computers are better do not directly connect wr7200. now,what wireless mode should i use?

It does not look like you have many choices. You have to go for the client/station mode.

Thanks alot. I tried sta mode,but it seems WIFI didnot start. could you help give me some advice?

A regular AP-STA link can't be in a bridge, it will not start. So operate as a routed client. Attach the wifi client to the wan. (Remove any Ethernet port from wan.) Usually you want the printer at a static IP address, so set the wan network to static IP within the main network.

Set the LAN IP address to something outside what the main network uses. You will need to open port 9100(TCP) with source wan in the firewall. Opening ports 22(TCP) and 80(TCP) will also allow you to administer from the main network side.

1 Like

hi,I am trying your solution now. and I have a question。if I set lan and WIFI in the same network,for example lan: 191.168.31.89,WIFI 192.168.31.88,use WIFI connect to the main router,what will happen?

For some routers' software this is not allowed and will produce error.
Otherwise it will cause unpredictable behavior.

It won't be able to route from the LAN to the WAN.

the tlwr720n could connect to the interNet and installed kmod-usb-printer p910nd. seems network is good.but the printer cannot work. could be any posible?

You will also need the USB printer drivers. p910nd is a connection from TCP to the lpt device created by a Linux printer driver, it does not go directly to the USB port.

Looking at the TP-Link page for that model, does it even have a USB port?

yes. it has usb port. and i have installed kmod-usb-printer software packet


thanks @mk24 and @trendy network configure as your advice.

root@OpenWrt:/etc/config# _cat network_
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'
config globals 'globals'
        option ula_prefix 'fd63:8335:a450::/48'
config interface 'lan'
        option type 'bridge'
        option ifname 'eth1'
        option proto 'static'
        option ipaddr '192.168.32.188'
        option netmask '255.255.255.0'
        option gateway '192.168.31.88'
        option ip6assign '60'
config interface 'lan1'
       option ifname 'eth0’
       option proto 'static'
        option ipaddr '192.168.33.188'
        option netmask '255.255.255.0'
        option gateway '192.168.31.88'
config interface 'wan'
        option proto 'static’
        option ipaddr '192.168.31.88'
        option netmask '255.255.255.0'
        option hostname 'Openwrt'
        option gateway '192.168.31.1'
        option dns   '192.168.1.1'
root@OpenWrt:/etc/config# _cat wireless_
config wifi-device 'radio0'
        option type 'mac80211'
        option channel '1'
        option hwmode '11g'
        option path 'platform/ar933x_wmac'
        option htmode 'HT20'
        option disabled '0'
config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'wan'
        # option network 'lan'
        option mode 'sta'
        option ssid 'nicework'
        option encryption 'psk2'
        option key ‘XXXXX'
root@OpenWrt:/etc/config# _cat firewall_
…
config rule
        option name 'forward_from_master'
        option src wan
        option dest lan
        option src_ip 192.168.31.0/24
        option proto all
        option target ACCEPT
#allow attached network printer
config rule
        option src wan
        option proto tcp
        option dest_port 9100
        option target ACCEPT

After that install printer and configure.

root@OpenWrt:/tmp# _Opkg update_
root@OpenWrt:/tmp# _Opkg install kmod-usb-printer_
root@OpenWrt:/tmp# _Opkg install p910nd_

root@OpenWrt:/etc/config# _cat p910nd_
        config p910nd
        option device        /dev/usb/lp0
        option port          0
        option bidirectional 1
        option enabled       1
        option bind 192.168.31.88

root@OpenWrt:/tmp# _/etc/init.d/p910nd enable_
root@OpenWrt:/tmp# _/etc/init.d/p910nd start_

But the printer cannot work...

So I debuging...

root@OpenWrt:/tmp# _ps|grep 91_
1233 root       912 S    {p910nd} /usr/sbin/**p9100d** -d -b -f /dev/usb/lp0 -i 192.168.31.88 0

root@OpenWrt:/tmp# _netstat -an|grep 91_
tcp        0      0 192.168.31.88:9100      0.0.0.0:*               LISTEN

root@OpenWrt:/tmp# _ls /usr/sbin/p9*_
/usr/sbin/p910nd

Seems there is no p9100d file here. So I try make a link for it

root@OpenWrt:/usr/sbin# _ln -s p910nd p9100d_
root@OpenWrt:/tmp# _ls -l /usr/sbin/p9*_
lrwxrwxrwx    1 root     root             6 Mar  1 13:37 /usr/sbin/p9100d -> p910nd
-rwxr-xr-x    1 root     root         12389 Feb 15 20:53 /usr/sbin/p910nd

printer works now.

1 Like

If your problem is solved, feel free to mark the relevant post as the solution; and edit the title to add "[SOLVED]" to the beginning (click the pencil behind the topic).

grafik

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.