OpenWrt Forum Archive

Topic: wifi client mode with static ip

The content of this topic has been archived on 7 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I have set up my asus wl-500w with kamikaze8.09.2 in wifi client mode like this and its working:

network:
#### VLAN configuration                                                                                                   
config switch eth0                                                                                                       
        option enable   1                                                                                                 
                                                                                                                         
config switch_vlan eth0_0                                                                                                 
        option device   "eth0"                                                                                           
        option vlan     0                                                                                                 
        option ports    "0 1 2 3 4 5u"                                                                                   
                                                                                                                         
#### Loopback configuration                                                                                               
config interface loopback                                                                                                 
        option ifname   "lo"                                                                                             
        option proto    static                                                                                           
        option ipaddr   127.0.0.1                                                                                         
        option netmask  255.0.0.0                                                                                         
                                   
#### LAN configuration                                                                                                   
config interface lan                                                                                                     
        option type     bridge                                                                                           
        option ifname   "eth0"                                                                                           
        option proto    static                                                                                           
        option ipaddr   192.168.2.1                                                                                       
        option netmask  255.255.255.0                                                                   

#### WAN configuration                                                                                                   
config interface        wan                                                                                               
        option ifname   "eth1"                                                                                           
        option proto    dhcp

wifi:
config 'wifi-device' 'wl0'
        option 'type' 'broadcom'
        option 'channel' '10'
        option 'disabled' '0'

config 'wifi-iface'
        option 'device' 'wl0'
        option 'network' 'wan'
        option 'mode' 'sta'
        option 'ssid' 'z60'
        option 'encryption' 'PSK+AES'
        option 'key' 'test-test'


but now I'd like to set wifi client with a static ip (e.g. 192.168.1.44) instead of getting an ip by AP (192.168.1.102 by ssid z60) because I need an fixed ip so I can access my router from my z60 network. can someone help me with the settings?
thanks j

(Last edited by dddesign on 21 Apr 2011, 08:07)

You shouldn't specify "option ifname" in WAN configuration unless you want to bridge the wired and wireless interfaces.

#### WAN configuration
config interface        wan
        option proto    static
        option ipaddr   192.168.1.44
        option netmask  255.255.255.0
        option gateway  192.168.1.1
        option dns      '8.8.8.8 8.8.4.4'

Thanks, this is working.
But I have no internet! I can ping my z60 router 192.168.1.1 (and all other machines in the network) but if I ping google.com I get following error: bad address 'google.com'
Is the option dns needed or optional? Right now I havn't set it. Or is it something in the firewall settings? What should it look like?
Thanks for your help
J

Thanks you for the post.
Hi guys, Im a newbie. Nice to join this forum.

If you can ping a google site like 209.85.135.103 but not www.google.com, then it is your dns.  You need to include that line as shown in post 2.

I can't ping this ip. I get this error:
ping: sendto: Network is unreachable

what is wrong? something with my firewall settings? here they are:

config defaults                                 
        option syn_flood        1               
        option input            ACCEPT           
        option output           ACCEPT           
        option forward          REJECT           
                                                 
config zone                                     
        option name             lan             
        option input    ACCEPT                   
        option output   ACCEPT                   
        option forward  REJECT                   
                                                 
config zone                                     
        option name             wan             
        option input    ACCEPT                   
        option output   ACCEPT                   
        option forward  REJECT                   
        option masq             1               
        option mtu_fix  1                       
                                                 
config forwarding                               
        option src      lan                     
        option dest     wan                     
                                                 
# We need to accept udp packets on port 68,     
# see https://dev.openwrt.org/ticket/4108       
config rule                                     
        option src              wan             
        option proto            udp             
        option dest_port        68               
        option target           ACCEPT           
                                                 
# include a file with users custom iptables rules
config include                               
        option path /etc/firewall.user

I found the solution
@alex: thanks

I changed my wan config to:

#### WAN configuration
config interface        wan
        option proto    static
        option ipaddr   192.168.1.44
        option netmask  255.255.255.0
        option gateway  192.168.1.1
        option dns      192.168.1.1

The discussion might have continued from here.