Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, all, I have two wireless cards, wlan0 and wlan1 I want to configure wlan1 with an IP address 192.168.1.254 in run-level 3 mode I typed Code: ifconfig wlan1 192.168.1.254 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    87

    ifconfig ip address doesn't work


    Hi, all,

    I have two wireless cards, wlan0 and wlan1
    I want to configure wlan1 with an IP address 192.168.1.254
    in run-level 3 mode
    I typed
    Code:
     ifconfig wlan1 192.168.1.254
    then I typed
    Code:
    ifconfig
    it shows the ip address for wlan1 is 192.168.1.254
    however, after tens of seconds, there is no IPV4 addresses for wlan1. What is wrong with this?

    a similiar phenomenon is if I use "ifconfig wlan0 down" to disable wlan0, and then I type
    Code:
    ifconfig
    , "wlan0" is not shown. However, after some time, it shows again.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    that sounds quite odd. a couple of questions first:

    1. what is your distro?

    2. are wlan0 and wlan0 using the same driver? you can check with:
    Code:
    ethtool -i wlan0;ethtool -i wlan1
    3. is the device wlan1 already configured for DHCP? if so, have you tried disabling that in the network configuration files (distro-dependent)?

  3. #3
    Just Joined!
    Join Date
    May 2012
    Posts
    87
    1. what is your distro?
    ----------------------------------------------------------------------
    fedora 16

    2. are wlan0 and wlan0 using the same driver? you can check with:
    Code:
    ethtool -i wlan0;ethtool -i wlan1
    -----------------------------------------------------------------
    wlan0 iw13945
    wlan1 ath5k

    3. is the device wlan1 already configured for DHCP? if so, have you tried disabling that in the network configuration files (distro-dependent)?
    -----------------------------------------------------------------
    yes


    the problem is that I want to make the laptop into a access point.
    so I use wlan1 for the AP wireless card. And I used hostapd and DHCP server on wlan1. The WLAN1 is put in master mode and as a router. Before I start the hostapd and DHCP server mode, the wlan1 is with a DHCP-allocated IP address, but after I start hostapd, the allocated ip address disappears. If I use "ifconfig" to configure wlan1 with a private ip address, this address only persists for tens of seconds and thus the AP works for tens of seconds. But sometimes, it works normally. So it is very strange.

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    i wonder if using the ip tool (from the iproute2 package) to change the ip address (instead of ifconfig) would make a difference? i really have no idea, as like you say, this issue is weird. but it is worth a shot. usage, e.g.:

    Code:
    ip addr add 192.168.1.2/24 dev wlan0

  5. #5
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Quote Originally Posted by esolve View Post
    Code:
     ifconfig wlan1 192.168.1.254
    You first should bring down the interface, if it is not already down, with
    Code:
    ifdown wlan1
    Then bring up the interface with the ip address you want with
    Code:
    ifconfig wlan1 192.168.1.254 netmask 255.255.255.0 up

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  6. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    something else occurred to me. you might want to try disabling the NetworkManager and Avahi stuff, just as an experiment. you have to make sure that all your wireless settings are in the /etc/sysconfig/network-scripts/ifcfg-* scripts, though (they should be already). or you can use iwconfig to set them manually, of course.

    to see if they are running:
    Code:
    systemctl status NetworkManager.service
    systemctl status avahi-daemon.service
    to turn off either service found to be running:
    Code:
    systemctl stop NetworkManager.service
    systemctl stop avahi-daemon.service
    and disable them:
    Code:
    systemctl disable NetworkManager.service
    systemctl disable avahi-daemon.service
    now would be a good time to double-check your ifcfg-* scripts (make sure wireless settings are in there, maybe disable DHCP in favor of static ip, if possible, etc.).

    then restart networking:
    Code:
    service network restart
    then make sure your wirless stuff started up properly using iwconfig.

    if that doesn't help, you can re-enable disabled services with:
    Code:
    systemctl enable <service_name>.service
    and then restart them with:
    Code:
    systemctl restart <service_name>.service
    or just reboot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •