FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 09-06-2008, 01:10 PM
Dan Johansson
 
Default Automatic network configuration for USB connected device

I have bought me a new toy - an Openmoko Freerunner.
Each time I connect it to my Gentoo-box I must configure the usb0 device on
the Gentoo-box as follows:
ifconfig usb0 192.168.0.200 netmask 255.255.255.248
After that I can without problem ssh to the Freerunner. Now I want the above
to be automatically done when I connect the Freerunner. I have found the the
following description for Ubunto:

Add the following lines to your /etc/network/interfaces :
allow-hotplug usb0
auto usb0
iface usb0 inet static
address 192.168.0.200
netmask 255.255.255.0
network 192.168.0.0
up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
up echo 1 > /proc/sys/net/ipv4/ip_forward &
up iptables -P FORWARD ACCEPT &
down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24

What would be the corresponding file(s) on Gentoo?
Regards,
--
Dan Johansson, <http://www.dmj.nu>
************************************************** *
This message is printed on 100% recycled electrons!
************************************************** *
 
Old 09-06-2008, 01:29 PM
Hong Hao
 
Default Automatic network configuration for USB connected device

Dan Johansson wrote:

I have bought me a new toy - an Openmoko Freerunner.
Each time I connect it to my Gentoo-box I must configure the usb0 device on
the Gentoo-box as follows:
ifconfig usb0 192.168.0.200 netmask 255.255.255.248
After that I can without problem ssh to the Freerunner. Now I want the above
to be automatically done when I connect the Freerunner. I have found the the
following description for Ubunto:


Add the following lines to your /etc/network/interfaces :
allow-hotplug usb0
auto usb0
iface usb0 inet static
address 192.168.0.200
netmask 255.255.255.0
network 192.168.0.0
up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
up echo 1 > /proc/sys/net/ipv4/ip_forward &
up iptables -P FORWARD ACCEPT &
down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24

What would be the corresponding file(s) on Gentoo?
Regards,


/etc/conf.d/network
 
Old 09-06-2008, 01:33 PM
Daniel Pielmeier
 
Default Automatic network configuration for USB connected device

Hong Hao schrieb am 06.09.2008 15:29:

Dan Johansson wrote:

I have bought me a new toy - an Openmoko Freerunner.
Each time I connect it to my Gentoo-box I must configure the usb0
device on the Gentoo-box as follows:
ifconfig usb0 192.168.0.200 netmask 255.255.255.248 After that I can
without problem ssh to the Freerunner. Now I want the above to be
automatically done when I connect the Freerunner. I have found the the
following description for Ubunto:


Add the following lines to your /etc/network/interfaces :
allow-hotplug usb0
auto usb0
iface usb0 inet static
address 192.168.0.200
netmask 255.255.255.0
network 192.168.0.0
up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
up echo 1 > /proc/sys/net/ipv4/ip_forward &
up iptables -P FORWARD ACCEPT &
down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24

What would be the corresponding file(s) on Gentoo?
Regards,


/etc/conf.d/network




I would try this: /etc/conf.d/net :-)
 
Old 09-06-2008, 01:52 PM
Dan Johansson
 
Default Automatic network configuration for USB connected device

On Saturday 06 September 2008, Daniel Pielmeier wrote:
> Hong Hao schrieb am 06.09.2008 15:29:
> > Dan Johansson wrote:
> >> I have bought me a new toy - an Openmoko Freerunner.
> >> Each time I connect it to my Gentoo-box I must configure the usb0
> >> device on the Gentoo-box as follows:
> >> ifconfig usb0 192.168.0.200 netmask 255.255.255.248 After that I can
> >> without problem ssh to the Freerunner. Now I want the above to be
> >> automatically done when I connect the Freerunner. I have found the the
> >> following description for Ubunto:
> >>
> >> Add the following lines to your /etc/network/interfaces :
> >> allow-hotplug usb0
> >> auto usb0
> >> iface usb0 inet static
> >> address 192.168.0.200
> >> netmask 255.255.255.0
> >> network 192.168.0.0
> >> up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
> >> up echo 1 > /proc/sys/net/ipv4/ip_forward &
> >> up iptables -P FORWARD ACCEPT &
> >> down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
> >>
> >> What would be the corresponding file(s) on Gentoo?
> >> Regards,
> >
> > /etc/conf.d/network
>
> I would try this: /etc/conf.d/net :-)
Thanks, I should have done some googling before I ask....
I added the following to /etc/conf.d/net:

config_usb0=( "192.168.0.200 netmask 255.255.255.248" )
routes_usb0=( "192.168.0.202/32 via 192.168.0.200" )

preup() {
if [ ${IFACE} = "usb0" ]
then
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT
iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
fi
return 0
}

postdown() {
if [ ${IFACE} = "usb0" ]
then
echo 0 > /proc/sys/net/ipv4/ip_forward
iptables -D INPUT -s 192.168.0.202 -j ACCEPT
iptables -D OUTPUT -s 192.168.0.200 -j ACCEPT
iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
fi
return 0
}

and linked /etc/init.d/net.lo to /etc/init.d/net.usb0

--
Dan Johansson, <http://www.dmj.nu>
************************************************** *
This message is printed on 100% recycled electrons!
************************************************** *
 
Old 09-06-2008, 04:15 PM
Xav'
 
Default Automatic network configuration for USB connected device

Le Saturday 06 September 2008 15:52:57 Dan Johansson, vous avez écrit*:
> On Saturday 06 September 2008, Daniel Pielmeier wrote:
> > Hong Hao schrieb am 06.09.2008 15:29:
> > > Dan Johansson wrote:
> > >> I have bought me a new toy - an Openmoko Freerunner.
> > >> Each time I connect it to my Gentoo-box I must configure the usb0
> > >> device on the Gentoo-box as follows:
> > >> ifconfig usb0 192.168.0.200 netmask 255.255.255.248 After that I can
> > >> without problem ssh to the Freerunner. Now I want the above to be
> > >> automatically done when I connect the Freerunner. I have found the the
> > >> following description for Ubunto:
> > >>
> > >> Add the following lines to your /etc/network/interfaces :
> > >> allow-hotplug usb0
> > >> auto usb0
> > >> iface usb0 inet static
> > >> address 192.168.0.200
> > >> netmask 255.255.255.0
> > >> network 192.168.0.0
> > >> up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
> > >> up echo 1 > /proc/sys/net/ipv4/ip_forward &
> > >> up iptables -P FORWARD ACCEPT &
> > >> down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
> > >>
> > >> What would be the corresponding file(s) on Gentoo?
> > >> Regards,
> > >
> > > /etc/conf.d/network
> >
> > I would try this: /etc/conf.d/net :-)
>
> Thanks, I should have done some googling before I ask....
> I added the following to /etc/conf.d/net:
>
> config_usb0=( "192.168.0.200 netmask 255.255.255.248" )
> routes_usb0=( "192.168.0.202/32 via 192.168.0.200" )
>
> preup() {
> if [ ${IFACE} = "usb0" ]
> then
> echo 1 > /proc/sys/net/ipv4/ip_forward
> iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT
> iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT
> iptables -A POSTROUTING -t nat -j MASQUERADE -s
> 192.168.0.0/24 fi
> return 0
> }
>
> postdown() {
> if [ ${IFACE} = "usb0" ]
> then
> echo 0 > /proc/sys/net/ipv4/ip_forward
> iptables -D INPUT -s 192.168.0.202 -j ACCEPT
> iptables -D OUTPUT -s 192.168.0.200 -j ACCEPT
> iptables -D POSTROUTING -t nat -j MASQUERADE -s
> 192.168.0.0/24 fi
> return 0
> }
>
> and linked /etc/init.d/net.lo to /etc/init.d/net.usb0

You can also use /etc/init.d/iptables script for saving iptables rules and
restoring it at startup, and /etc/sysctl.conf for net.ipv4.ip_forward

Regards.

Xavier Parizet
 
Old 09-06-2008, 08:08 PM
Neil Bothwick
 
Default Automatic network configuration for USB connected device

On Sat, 6 Sep 2008 18:15:04 +0200, Xav' wrote:

> You can also use /etc/init.d/iptables script for saving iptables rules
> and restoring it at startup, and /etc/sysctl.conf for
> net.ipv4.ip_forward

Yes, but by putting them in the preup/down functions, the rules are only
active when the devices is attached.


--
Neil Bothwick

In a classified ad: "Tired of cleaning yourself? Let me do it."
 
Old 09-07-2008, 10:52 AM
Dan Johansson
 
Default Automatic network configuration for USB connected device

On Saturday 06 September 2008, Dan Johansson wrote:
> On Saturday 06 September 2008, Daniel Pielmeier wrote:
> > Hong Hao schrieb am 06.09.2008 15:29:
> > > Dan Johansson wrote:
> > >> I have bought me a new toy - an Openmoko Freerunner.
> > >> Each time I connect it to my Gentoo-box I must configure the usb0
> > >> device on the Gentoo-box as follows:
> > >> ifconfig usb0 192.168.0.200 netmask 255.255.255.248 After that I can
> > >> without problem ssh to the Freerunner. Now I want the above to be
> > >> automatically done when I connect the Freerunner. I have found the the
> > >> following description for Ubunto:
> > >>
> > >> Add the following lines to your /etc/network/interfaces :
> > >> allow-hotplug usb0
> > >> auto usb0
> > >> iface usb0 inet static
> > >> address 192.168.0.200
> > >> netmask 255.255.255.0
> > >> network 192.168.0.0
> > >> up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 &
> > >> up echo 1 > /proc/sys/net/ipv4/ip_forward &
> > >> up iptables -P FORWARD ACCEPT &
> > >> down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
> > >>
> > >> What would be the corresponding file(s) on Gentoo?
> > >> Regards,
> > >
> > > /etc/conf.d/network
> >
> > I would try this: /etc/conf.d/net :-)
>
> Thanks, I should have done some googling before I ask....
> I added the following to /etc/conf.d/net:
>
> config_usb0=( "192.168.0.200 netmask 255.255.255.248" )
> routes_usb0=( "192.168.0.202/32 via 192.168.0.200" )
>
> preup() {
> if [ ${IFACE} = "usb0" ]
> then
> echo 1 > /proc/sys/net/ipv4/ip_forward
> iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT
> iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT
> iptables -A POSTROUTING -t nat -j MASQUERADE -s
> 192.168.0.0/24 fi
> return 0
> }
>
> postdown() {
> if [ ${IFACE} = "usb0" ]
> then
> echo 0 > /proc/sys/net/ipv4/ip_forward
> iptables -D INPUT -s 192.168.0.202 -j ACCEPT
> iptables -D OUTPUT -s 192.168.0.200 -j ACCEPT
> iptables -D POSTROUTING -t nat -j MASQUERADE -s
> 192.168.0.0/24 fi
> return 0
> }
>
> and linked /etc/init.d/net.lo to /etc/init.d/net.usb0
The above worked like a charm on my desktop but on my notebook it fails to
autoaticly bring up the usb0 interface. If I do '/etc/init.d/net.usb0 start'
on the notebook everything works as expected (this I don't have to do on the
desktop). Any suggestions where to look?
--
Dan Johansson, <http://www.dmj.nu>
************************************************** *
This message is printed on 100% recycled electrons!
************************************************** *
 
Old 09-07-2008, 11:36 AM
Remy Blank
 
Default Automatic network configuration for USB connected device

Dan Johansson wrote:
The above worked like a charm on my desktop but on my notebook it fails to
autoaticly bring up the usb0 interface. If I do '/etc/init.d/net.usb0 start'
on the notebook everything works as expected (this I don't have to do on the
desktop). Any suggestions where to look?


You may have the following line in your /etc/conf.d/rc:

RC_PLUG_SERVICES="!net.*"

This disables automatic starting of network services. You should replace
it with something like:


RC_PLUG_SERVICES="!net.eth0 !net.wlan0"

where you enumerate the network services you *don't* want to start, and
of course leave out net.usb0.


-- Remy
 
Old 09-07-2008, 01:11 PM
Dan Johansson
 
Default Automatic network configuration for USB connected device

On Sunday 07 September 2008, Remy Blank wrote:
> Dan Johansson wrote:
> > The above worked like a charm on my desktop but on my notebook it fails
> > to autoaticly bring up the usb0 interface. If I do '/etc/init.d/net.usb0
> > start' on the notebook everything works as expected (this I don't have to
> > do on the desktop). Any suggestions where to look?
>
> You may have the following line in your /etc/conf.d/rc:
>
> RC_PLUG_SERVICES="!net.*"
>
> This disables automatic starting of network services. You should replace
> it with something like:
>
> RC_PLUG_SERVICES="!net.eth0 !net.wlan0"
>
> where you enumerate the network services you *don't* want to start, and
> of course leave out net.usb0.
>
> -- Remy
Thanks! I'd forgotten about that setting (last changed in 2006).
--
Dan Johansson, <http://www.dmj.nu>
************************************************** *
This message is printed on 100% recycled electrons!
************************************************** *
 
Old 09-07-2008, 09:51 PM
James
 
Default Automatic network configuration for USB connected device

Dan Johansson <Dan.Johansson <at> dmj.nu> writes:


> I have bought me a new toy - an Openmoko Freerunner.


Hello Dan,

The gentoo embedded linux group is doing quite a lot of work on openmoko
and many other pda's:

Here's a little diddy from Angelo Miguel Arrifano
"

Me and Ned Ludd are working on a embedded overlay mostly for PDAs.
The overlay is located here:
http://tinderbox.dev.gentoo.org/embedded/linwizard/overlay/
The overlay includes some fixed ebuilds for cross-compiling base
dependencies. There is also a GPE tree there that should be emergeable.
More recently, we started to work on openmoko ebuilds. It's not finished
yet.

We also provide binary packages for ARMV5TE-JL here:
http://tinderbox.dev.gentoo.org/embedded/linwizard/
"

I not sure you are interested in putting embedded gentoo on
your openmoko, but you should be aware that folks are working
on these sorts of goodies, for the gentoo community.

hth,

James
 

Thread Tools




All times are GMT. The time now is 02:07 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org