public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Assigning an IP in AP mode
@ 2011-08-12  2:11 Grant
  2011-08-12  4:29 ` Adam Carter
  0 siblings, 1 reply; 9+ messages in thread
From: Grant @ 2011-08-12  2:11 UTC (permalink / raw
  To: Gentoo mailing list

Does anyone know how to assign an IP address to a wireless interface
in AP mode?  It can't be specified in /etc/conf.d/net because
/etc/init.d/net.wlan0 is not executed since hostapd handles the whole
thing.  'ifconfig wlan0 192.168.0.1' works but I know I've done it
before without issuing that command each time I reboot, I just can't
remember how.

BTW, can I assign IP addresses on the same subnet to the 2 wireless
interfaces in my system if one of them connects to the WAN and the
other to the LAN?

- Grant



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-12  2:11 [gentoo-user] Assigning an IP in AP mode Grant
@ 2011-08-12  4:29 ` Adam Carter
  2011-08-13 15:43   ` [gentoo-user] " James
  2011-08-14  3:41   ` [gentoo-user] " Grant
  0 siblings, 2 replies; 9+ messages in thread
From: Adam Carter @ 2011-08-12  4:29 UTC (permalink / raw
  To: gentoo-user

On Fri, Aug 12, 2011 at 12:11 PM, Grant <emailgrant@gmail.com> wrote:
> Does anyone know how to assign an IP address to a wireless interface
> in AP mode?  It can't be specified in /etc/conf.d/net because
> /etc/init.d/net.wlan0 is not executed since hostapd handles the whole
> thing.  'ifconfig wlan0 192.168.0.1' works but I know I've done it
> before without issuing that command each time I reboot, I just can't
> remember how.

In /etc/conf.d/net as usual, just disable iwconfig and wpa_supplicant
in modules_wlan0

> BTW, can I assign IP addresses on the same subnet to the 2 wireless
> interfaces in my system if one of them connects to the WAN and the
> other to the LAN?

You probably don't want to do that. It will give you two connected
routes for the subnet, and only the one with the better metric will be
used, so you wont be able to communicate with hosts on the other
interface. You could probably setup bridging, but IMO it would almost
certainly be better to just use different subnets.

I could be wrong though - try it and see what happens.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [gentoo-user] Re: Assigning an IP in AP mode
  2011-08-12  4:29 ` Adam Carter
@ 2011-08-13 15:43   ` James
  2011-08-14  3:42     ` Grant
  2011-08-14  3:41   ` [gentoo-user] " Grant
  1 sibling, 1 reply; 9+ messages in thread
From: James @ 2011-08-13 15:43 UTC (permalink / raw
  To: gentoo-user

Adam Carter <adamcarter3 <at> gmail.com> writes:


> > BTW, can I assign IP addresses on the same subnet to the 2 wireless
> > interfaces in my system if one of them connects to the WAN and the
> > other to the LAN?

Yes and no. (see below).

> You probably don't want to do that. It will give you two connected
> routes for the subnet, and only the one with the better metric will be
> used, so you wont be able to communicate with hosts on the other
> interface. You could probably setup bridging, but IMO it would almost
> certainly be better to just use different subnets.

YES; Depending on how your "subnet" and what netmask(s) you use. Routinely
a given class C (for example)  is broken down to more smaller
address spaces (subnets) and not the x.x.x.0-255 range of a 
typical class C addressing scheme.

Avoid asymmetrical routing: 
https://my.stonesoft.com/support/document.do?docid=1377

You need to read up on this and understand things before getting
fancy on subnets. Router jocks do this all day, every day. Cisco
use to have some fabulous docs on the net, but I do not think
they are available any more without a support contract.
 I.E. typically folks subnet on the class C boundary 
(for example; 192.168.44.x) as it is cleaner and easier
to configure.  But if you break down a Class C to smaller subnets, 
actually they are different subnets, so the real answer is 
NO, unless you want routing instability or want to use ugly hacks,
or handle by the port/service with something like netfilter/bridging/etc.

There are tools on the net to help you figure out how to break down
a typical Class C network, to various smaller subnets.


hth,
James





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-12  4:29 ` Adam Carter
  2011-08-13 15:43   ` [gentoo-user] " James
@ 2011-08-14  3:41   ` Grant
  2011-08-15  1:45     ` Adam Carter
  1 sibling, 1 reply; 9+ messages in thread
From: Grant @ 2011-08-14  3:41 UTC (permalink / raw
  To: gentoo-user

>> Does anyone know how to assign an IP address to a wireless interface
>> in AP mode?  It can't be specified in /etc/conf.d/net because
>> /etc/init.d/net.wlan0 is not executed since hostapd handles the whole
>> thing.  'ifconfig wlan0 192.168.0.1' works but I know I've done it
>> before without issuing that command each time I reboot, I just can't
>> remember how.
>
> In /etc/conf.d/net as usual, just disable iwconfig and wpa_supplicant
> in modules_wlan0

I've added 'INTERFACES=wlan0' to /etc/conf.d/hostapd, created the
/etc/init.d/net.wlan0 link, and added the following to
/etc/conf.d/net:

modules_wlan0=( "!iwconfig" "!wpa_supplicant" )
config_wlan0="192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"

When I start hostapd it tries to start net.wlan0 but I get "WARNING:
net.wlan0 has started, but is inactive" and hostapd won't start.  If I
don't add the INTERFACES line and start hostapd and then net.wlan0,
hostapd starts but has no IP address and net.wlan0 gives me the same
"inactive" error.

I know I've had this working several times before but I always have a
hard time remembering how I did it.  I've definitely never disabled
iwconfig and wpa_supplicant before.

- Grant



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Re: Assigning an IP in AP mode
  2011-08-13 15:43   ` [gentoo-user] " James
@ 2011-08-14  3:42     ` Grant
  0 siblings, 0 replies; 9+ messages in thread
From: Grant @ 2011-08-14  3:42 UTC (permalink / raw
  To: gentoo-user

>> > BTW, can I assign IP addresses on the same subnet to the 2 wireless
>> > interfaces in my system if one of them connects to the WAN and the
>> > other to the LAN?
>
> Yes and no. (see below).
>
>> You probably don't want to do that. It will give you two connected
>> routes for the subnet, and only the one with the better metric will be
>> used, so you wont be able to communicate with hosts on the other
>> interface. You could probably setup bridging, but IMO it would almost
>> certainly be better to just use different subnets.
>
> YES; Depending on how your "subnet" and what netmask(s) you use. Routinely
> a given class C (for example)  is broken down to more smaller
> address spaces (subnets) and not the x.x.x.0-255 range of a
> typical class C addressing scheme.
>
> Avoid asymmetrical routing:
> https://my.stonesoft.com/support/document.do?docid=1377
>
> You need to read up on this and understand things before getting
> fancy on subnets. Router jocks do this all day, every day. Cisco
> use to have some fabulous docs on the net, but I do not think
> they are available any more without a support contract.
>  I.E. typically folks subnet on the class C boundary
> (for example; 192.168.44.x) as it is cleaner and easier
> to configure.  But if you break down a Class C to smaller subnets,
> actually they are different subnets, so the real answer is
> NO, unless you want routing instability or want to use ugly hacks,
> or handle by the port/service with something like netfilter/bridging/etc.
>
> There are tools on the net to help you figure out how to break down
> a typical Class C network, to various smaller subnets.
>
>
> hth,
> James

Got it, thank you James.

- Grant



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-14  3:41   ` [gentoo-user] " Grant
@ 2011-08-15  1:45     ` Adam Carter
  2011-08-15  3:38       ` Grant
  0 siblings, 1 reply; 9+ messages in thread
From: Adam Carter @ 2011-08-15  1:45 UTC (permalink / raw
  To: gentoo-user

> I've added 'INTERFACES=wlan0' to /etc/conf.d/hostapd, created the
> /etc/init.d/net.wlan0 link, and added the following to
> /etc/conf.d/net:
>
> modules_wlan0=( "!iwconfig" "!wpa_supplicant" )
> config_wlan0="192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"
>
> When I start hostapd it tries to start net.wlan0 but I get "WARNING:
> net.wlan0 has started, but is inactive" and hostapd won't start.  If I
> don't add the INTERFACES line and start hostapd and then net.wlan0,
> hostapd starts but has no IP address and net.wlan0 gives me the same
> "inactive" error.

I have the link inactive message (warning != error) on my client
system, then it associates so the link becomes active, and then
dhcp's. I dont get that message on my AP machine tho, but dmesg has
"wlan0: link is not ready"

I have net.wlan0 started by init, not by hostapd, not sure if that
makes a difference.

What message does hostapd report? AFAIK, it shouldn't care about wlan0
not having link.

> I know I've had this working several times before but I always have a
> hard time remembering how I did it.  I've definitely never disabled
> iwconfig and wpa_supplicant before.

That's from here;
http://www.gentoo-wiki.info/Wireless/libnl_Access_Point



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-15  1:45     ` Adam Carter
@ 2011-08-15  3:38       ` Grant
  2011-08-15  3:55         ` Adam Carter
  0 siblings, 1 reply; 9+ messages in thread
From: Grant @ 2011-08-15  3:38 UTC (permalink / raw
  To: gentoo-user

>> I've added 'INTERFACES=wlan0' to /etc/conf.d/hostapd, created the
>> /etc/init.d/net.wlan0 link, and added the following to
>> /etc/conf.d/net:
>>
>> modules_wlan0=( "!iwconfig" "!wpa_supplicant" )
>> config_wlan0="192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"
>>
>> When I start hostapd it tries to start net.wlan0 but I get "WARNING:
>> net.wlan0 has started, but is inactive" and hostapd won't start.  If I
>> don't add the INTERFACES line and start hostapd and then net.wlan0,
>> hostapd starts but has no IP address and net.wlan0 gives me the same
>> "inactive" error.
>
> I have the link inactive message (warning != error) on my client
> system, then it associates so the link becomes active, and then
> dhcp's. I dont get that message on my AP machine tho, but dmesg has
> "wlan0: link is not ready"

Yeah the "inactive" warning isn't very informative.  I get that
message all the time when starting an interface in managed mode.

> I have net.wlan0 started by init, not by hostapd, not sure if that
> makes a difference.

You start net.wlan0 in master mode with /etc/init.d/net.wlan0?  If so,
do you have a PSK?

> What message does hostapd report? AFAIK, it shouldn't care about wlan0
> not having link.

hostapd doesn't report any error and I don't think it should.
Everything works fine as soon as I 'ifconfig wlan0 192.168.1.1' but I
know there's a way to assign that IP automatically, I've just
forgotten what it is.  My description above is the trouble I run into
when I try to set up that automatic IP assignment.  As long as I issue
ifconfig manually, everything works fine.

>> I know I've had this working several times before but I always have a
>> hard time remembering how I did it.  I've definitely never disabled
>> iwconfig and wpa_supplicant before.
>
> That's from here;
> http://www.gentoo-wiki.info/Wireless/libnl_Access_Point

Is anyone here running hostapd?  It's the Gentoo+hostapd combo that
has me stumped.

- Grant



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-15  3:38       ` Grant
@ 2011-08-15  3:55         ` Adam Carter
  2011-08-15 23:36           ` Grant
  0 siblings, 1 reply; 9+ messages in thread
From: Adam Carter @ 2011-08-15  3:55 UTC (permalink / raw
  To: gentoo-user

>> I have net.wlan0 started by init, not by hostapd, not sure if that
>> makes a difference.
>
> You start net.wlan0 in master mode with /etc/init.d/net.wlan0?  If so,
> do you have a PSK?

No - master mode comes with hostapd. It just gets started.

> hostapd doesn't report any error and I don't think it should.
> Everything works fine as soon as I 'ifconfig wlan0 192.168.1.1' but I
> know there's a way to assign that IP automatically, I've just
> forgotten what it is.  My description above is the trouble I run into
> when I try to set up that automatic IP assignment.  As long as I issue
> ifconfig manually, everything works fine.

Just let net.wlan0 bring the interface up and configure the IP for you.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [gentoo-user] Assigning an IP in AP mode
  2011-08-15  3:55         ` Adam Carter
@ 2011-08-15 23:36           ` Grant
  0 siblings, 0 replies; 9+ messages in thread
From: Grant @ 2011-08-15 23:36 UTC (permalink / raw
  To: gentoo-user

>> hostapd doesn't report any error and I don't think it should.
>> Everything works fine as soon as I 'ifconfig wlan0 192.168.1.1' but I
>> know there's a way to assign that IP automatically, I've just
>> forgotten what it is.  My description above is the trouble I run into
>> when I try to set up that automatic IP assignment.  As long as I issue
>> ifconfig manually, everything works fine.
>
> Just let net.wlan0 bring the interface up and configure the IP for you.

Thank you, I just needed to correct the modules_wlan0 syntax from that
page.  It should be:

modules_wlan0="!iwconfig !wpa_supplicant"

http://www.gentoo-wiki.info/Wireless/libnl_Access_Point#Configuration_of_hostapd

- Grant



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-15 23:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12  2:11 [gentoo-user] Assigning an IP in AP mode Grant
2011-08-12  4:29 ` Adam Carter
2011-08-13 15:43   ` [gentoo-user] " James
2011-08-14  3:42     ` Grant
2011-08-14  3:41   ` [gentoo-user] " Grant
2011-08-15  1:45     ` Adam Carter
2011-08-15  3:38       ` Grant
2011-08-15  3:55         ` Adam Carter
2011-08-15 23:36           ` Grant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox