1

Background:

I have to set up some Epson receipt printers. The printers are configured by pointing your web browser to http://192.168.192.168/ and submitting a form. I wrote a Python script that can simulate a form POST, and the printers can now be configured without using the web interface. The one drawback is that my computer must be on the 192.168.192.0/24 network.

Question:

Is it possible to create a virtual network interface in Python that my script can use without me having to manually change the computers network settings?

3
  • 1
    Please specify which operating system. Commented Jun 8, 2011 at 20:35
  • @aix, Linux (CentOS 4.8 to be precise) Commented Jun 8, 2011 at 20:38
  • 2
    Python just uses the network stack of your kernel. If you can't ping it, Python can't do anything. You need to properly setup IP addresses, routing, and possibly tunneling at the OS/system level first. Commented Jun 8, 2011 at 20:43

1 Answer 1

3

You have a problem that python cannot solve.

It sounds like your network has been administratively compartmentalized for some reason. If there is a firewall or a bastion-host machine connected to both administrative domains, you might be able to leverage Port Address Translation to keep this server on one network and poll the other.

If 192.168.192.0 has not been intentionally segmented for administrative / security reasons; it could be a simple oversight by your LAN administrator. In that case, they can add 192.168.192.0 to the corporate routing table.

The final option would be some kind of VPN connectivity between the administrative domains... again, discuss with your network admins.

EDIT

Since you need a linux ethernet alias, the easiest way is with iproute2 in linux... use ip addr add 192.168.192.1/24 dev eth0 as root

[mpenning@Finger ~]$ sudo ip addr add 192.168.192.1/24 dev eth0
[mpenning@Finger ~]$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 78:2b:cb:0a:8c:f9 brd ff:ff:ff:ff:ff:ff
    inet 192.168.12.238/24 brd 192.168.12.255 scope global eth0
    inet 192.168.192.1/24 scope global eth0
    inet6 fe80::7a2b:cbff:fe0a:8cf9/64 scope link 
       valid_lft forever preferred_lft forever
[mpenning@Finger ~]$ ip route show
192.168.192.0/24 dev eth0  proto kernel  scope link  src 192.168.192.1 
192.168.12.0/24 dev eth0  proto kernel  scope link  src 192.168.12.238 
default via 192.168.12.236 dev eth0 
[mpenning@Finger ~]$

Now plug your printer into your ethernet switch... you should be able to ping 192.168.192.168... to remove: ip addr del 192.168.192.1/24 dev eth0 (as root)

Sign up to request clarification or add additional context in comments.

4 Comments

192.168.192.168 is the default IP address of an Epson printer straight out of the box. The instructions tell you to change your IP to be on this network for first-time configuration. Sorry for being unclear.
@Evil Elf, you can use a linux interface alias to solve this problem. I have to run to a meeting, but if you google it's probably solved by the time I'm done... if not, I'll post a hyperlink
@Evil Elf, I updated... let me know if you have further issues. Cheers
That's good, but the OP wanted a way to do it without manually changing the network settings, which this is doing. Of course these steps could be scripted if the script is run as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.