You are not logged in.
What is the archlinux equivalent to /etc/network/interfaces? I'm trying to setup USB networking with my Nokia N810 and from the Diablo Reference Guide, I need to add the following to /etc/network/interfaces:
mapping hotplug
script grep
map usb0
auto usb0
iface usb0 inet static
address 192.168.2.14
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
up iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
up echo 1 > /proc/sys/net/ipv4/ip_forward
down iptables -t nat -D POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
down echo 0 > /proc/sys/net/ipv4/ip_forward
How would I go about achieving the same in arch? Any help would be greatly appreciated.
Last edited by papabean (2009-03-27 22:53:06)
The world is full of tough guys. It does not need me to be one, too.
Offline
The netcfg package would be good for what you're trying to achieve.
http://wiki.archlinux.org/index.php/Network_Profiles
Use the POST_UP and POST_DOWN directives...
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Thank you.
I'll check out the wiki entry and post back with results.
The world is full of tough guys. It does not need me to be one, too.
Offline
Ok. I've read the wiki article. The POST_UP and POST_DOWN directives aren't mentioned there, but they are in the complete.example in /etc/network.d/examples.
I should be able to put together a usb0 profile except for the mapping directive in /etc/network/interfaces. In this case, it's tied to hotplug to auto-activate this profile when usb0 becomes available. How can I achieve the same result?
The world is full of tough guys. It does not need me to be one, too.
Offline
I'm not familiar with what you're talking about -- are you saying the mapping directive makes this interface up and down when the USB device is hotplugged?
ifplugd might be able to handle this maybe? I'm not sure.
Last edited by fukawi2 (2009-03-27 06:08:14)
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
hotplug is deprecated, and hasn't existed on Arch for years. I know Debian tends to use older software versions, but I'm honestly amazed to hear they're still using it.
udev can run a command when a device is detected, so have a look at that.
Offline
Also, once you get this working, it's a great candidate for making a wiki article, to help any other users who run into the same issue
[git] | [AURpkgs] | [arch-games]
Offline
Ok. I've got partial (or full, depending on your perspective) success.
Had to insert usbnet and cdc_ether into the kernel:
# modprobe usbnet
# modprobe cdc_ether
I attempted to create the usb0 interface several times manually via ifconfig. Multiple failures. Connected the N810 and voila! The usb0 interface was created:
# dmesg | tail -1
usb0: register 'cdc_ether' at usb-0000:00:08.2-4, CDC Ethernet Device, 62:ea:f5:93:65:f1
The interface was there but no IP (of course). So, I setup the networking via ifconfig:
# ifconfig usb0 192.168.2.14 netmask 255.255.255.0 broadcast 192.168.2.255
Per the reference manual, still need to setup iptables and enable ip_forwarding:
# iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE
# echo 1 > /proc/sys/net/ipv4/ip_forward
I imagine
# sysctl -w net.ipv4.ip_forward=1
should work as well.
Tested the usb networking:
~ ping -c 3 192.168.2.15
PING 192.168.2.15 (192.168.2.15) 56(84) bytes of data.
64 bytes from 192.168.2.15: icmp_seq=1 ttl=64 time=0.942 ms
I can ssh into the tablet as well, so I know that the usb networking is working correctly.
I tried to create a usb0 profile in /etc/network.d:
CONNECTION="usb0"
DESCRIPTION="IP over USB"
INTERFACE=usb0
#HOSTNAME=
# Interface Settings (use IP="dhcp" for DHCP)
IP="static"
IFOPTS="192.168.2.14 netmask 255.255.255.0 broadcast 192.168.2.255"
#GATEWAY=192.168.0.1
# Time to wait to connect to a network. Default 15.
TIMEOUT=10
# Commands to run at various stages of configuration
PRE_UP=
POST_UP="iptables -t nat -A POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE ; echo 1 > /proc/sys/net/ipv4/ip_forward"
PRE_DOWN=
POST_DOWN="iptables -t nat -D POSTROUTING -o eth0 -s 192.168.2.15 -j MASQUERADE ; echo 0 > /proc/sys/net/ipv4/ip_forward"
However, that does not work. I get the following message when trying to activate it via netcfg:
# netcfg usb0
> usb0 is not a valid connection, check spelling or look at examples
Any ideas?
The world is full of tough guys. It does not need me to be one, too.
Offline
In netcfg profiles, CONNECTION can be either "ethernet" or "wireless". In this case, it's "ethernet" - netcfg doesn't care that it's ethernet-over-usb.
Offline
In netcfg profiles, CONNECTION can be either "ethernet" or "wireless". In this case, it's "ethernet" - netcfg doesn't care that it's ethernet-over-usb.
Thank you. Changing the CONNECTION to "ethernet" fixed the profile. I can start up the usb0 interface with # netcfg usb0 and network with the tablet over USB.
The world is full of tough guys. It does not need me to be one, too.
Offline