Results 1 to 8 of 8

Thread: Kali refuses to keep static IP!

  1. #1
    Join Date
    2013-Oct
    Location
    USA
    Posts
    3

    Kali refuses to keep static IP!

    Greetings all,

    I am pulling my hair out trying to get my Kali VM to play well with static IP.

    My setup:

    Virtualbox
    -Kali 32-bit VM
    -Whonix 32-bit Gateway.

    I am trying to have Kali run behind Whonix to torify the entire OS. I know i can download Tor to Kali and use proxychains but I think torifying the entire OS would be better. 192.168.0.10 is the address for the Whonix interface I need to connect to.

    I've tried setting the static IP via command line:

    Code:
    ifconfig eth0 192.168.0.20/24
    route add default gw 192.168.0.10
    The results are intermittent. It might connect and then randomly disconnect a few minutes later. When this happens I type it "ifconfig eth0" only to find that the interface has dropped all the addressing a just gave it! My next step was to do it via /etc/network/interfaces with the following commands:

    Code:
    iface eth0 inet static
    address 192.168.0.20
    network 192.168.0.0
    netmask 255.255.255.0
    gateway 192.168.0.10
    up route add default gw 192.168.0.10
    down route del default gw 192.168.0.10
    P

    Absolutely NOTHING happens when I modify the interfaces file. I've done a reboot, I've done ifconfig down/up.... nothing.

    I tried playing around with the Virtualbox adapter type.... I tried all the PCNets and all the Intel PRO. Why isn't this extremely simple task working? Thanks in advance!

  2. #2
    Join Date
    2013-Mar
    Posts
    354
    Please post the whole /etc/network/interfaces file and erase the last 2 lines, you do not need them as you are setting the gateway. Also need to set the broadcast 192.168.0.255 in your case.

    If wireless, add this line too: wireless_essid essid

    Try that...

    Also remember this: If you have network manager or wicd, they can be overriding the manual configuration in the interfaces file.

  3. #3
    Join Date
    2013-Oct
    Location
    USA
    Posts
    3
    Thanks for your reply, this is my interfaces file.

    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # Static IP for eth0 (Whonix)
    iface eth0 inet static
    	address 192.168.0.20
    	network 192.168.0.0
    	netmask 255.255.255.255
            broadcast 192.168.0.255
    	gateway 192.168.0.10
    If wireless, add this line too: wireless_essid essid
    The Kali VM isn't using any wireless

    Also remember this: If you have network manager or wicd, they can be overriding the manual configuration in the interfaces file.
    Even if network manager is overriding the interfaces file, why can't I assign static IP via command line?

    Code:
    ifconfig eth0 192.168.0.20/24
    route add default gw 192.168.0.10 eth0

  4. #4
    Join Date
    2013-Mar
    Posts
    354
    Sorry about the delay my fried, I was out of town.

    Ok, let me quote:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # Static IP for eth0 (Whonix)
    iface eth0 inet static
    address 192.168.0.20
    network 192.168.0.0
    netmask 255.255.255.255
    broadcast 192.168.0.255
    gateway 192.168.0.10

    So far so good, but need to add this lines: auto eth0 and dns-nameservers xxxx.xxxx.xxxx.xxxx .....xxxx.xxxx.xxxx
    so the complete interface file will look like this:

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # Static IP for eth0 (Whonix)
    auto eth0
    iface eth0 inet static
    address 192.168.0.20
    network 192.168.0.0
    netmask 255.255.255.255
    broadcast 192.168.0.255
    gateway 192.168.0.10
    dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx xxx.xxx.xxx (write here your dns servers, up to 3 separated by a space)

    See the bolded lines, let me explain one by one:

    auto eth0: The parameter "auto" means 2 things:

    1. Speed negociation between the iface and the switch, router or whatever the external device the iface connects to, so it will be set to Auto.

    2. When booting, the boot scripts invoque the ifup command with the "a" parameter (stands for ALL) so it will bring up and configure all interfaces in the /etc/network/interfaces file.
    The /etc/network/interfaces file is the CONFIGURATION file to the IFUP command, PERIOD. So when booting scripts invoque the ifup -a you know what happens, it reads all interfaces in the "interfaces" file and brings up all ifaces with the "auto" parameter, period.

    dns-nameservers
    You need to know that the resolv.conf will be overwritten by any of this processes:
    1. Network-Manager
    2. Resolvconf program
    3. dhclient or dhcpcd, according to which one is installed in your system. If both are installed, it searches for any of those in this sequence: first the dhclient and then if not installed, looks for the dhcpcd.

    Now keeping that in mind, when booting and NetworkManager is loaded, it calls the dhclient (or dhcpcd) to get an IP address from dhcp server.

    But you need to configure the iface in your interface file to set eth0 to static. So the kernel (udevd) knows that the iface with static ip will be untouched by dhclient.

    Now, read the resolv.conf file and read the first line commented, it shows something like this:
    # Generated by NetworkManager

    See, no matter what you set up in the resolv.conf, the nameservers will be managed by Networkmanager, unless you do it a different way:

    1. set up the dns-nameservers in the interfaces file so when boot scripts bring up the interfaces (those wit the "a" parameter), it includes all info needed to connect.
    2. This step might not be needed but in my case, I did it and all works fine: install the resolvconf app from repos: aptitude install resolvconf

    Try without the resolvconf first,you should see you ip as you set it up.

    Reboot and check ip and the dns-servers in the resolv.conf file. If no dns-servers in the resolv.conf, then try the resolvconf app. If any doubt, please post.

    I have static ip and it works fine.
    Hope it helps.

  5. #5
    Join Date
    2013-Oct
    Location
    USA
    Posts
    3
    Sorry for the late reply!

    I modified the /etc/network/interfaces file per your suggestion and although the static IP appears to be correct when I use "ifconfig eth0" there is no network connectivity. Using the "route" command shows an empty route table. When I attempt to manually add the gateway with "route add default gw 192.168.0.10 eth0" I get an error that says network is unreachable.

  6. #6
    Join Date
    2013-Aug
    Posts
    3
    your netmask is wrong.

    netmask 255.255.255.0

    because you got class c with 192.168.0.0.

    so just add this in your config:

    iface eth0 inet static
    address 192.168.0.20
    network 192.168.0.0
    netmask 255.255.255.0
    broadcast 192.168.0.255
    gateway 192.168.0.10


    have fun in your network

  7. #7
    Join Date
    2013-Mar
    Posts
    354
    Thanks Stype, I ovrelooked that line..

    Whoiskamryn, you heard the man, change that 255 for a "0"....

  8. #8
    Join Date
    2014-Feb
    Posts
    1
    this thread seems like you can help me with my permanent mac address problem , im installed on hd...
    how can i stop the wicl or networkmanager so when i change my rc.local and the /etc/network , nano interfaces it saves how i want it to.

Similar Threads

  1. Kali 2.0 refuses incoming ssh connections
    By skorpinok in forum TroubleShooting Archive
    Replies: 1
    Last Post: 2016-01-02, 18:59
  2. Replies: 1
    Last Post: 2015-04-30, 06:48

Tags for this Thread

Posting Permissions

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