Wireless Army
This is a blog / tips and tricks website for web developers and security researchers.
follow us in feedly

connect: Network is unreachable
by admin
 at 2017-04-08 20:24:00.

In this article we will show you how to give an static ip to a linux box.

if you are trying to set an static ip address you may get an error like this:

connect: Network is unreachable

if you notice you can pin computers on the network but not websites.

all you need to do is run this command and it should would:

route add default gw

and if you may had other problems we will go trough how to do it

assuming you have your router set up like this:

router ip:


you need to open the file /etc/network/inerfaces

and comment out these two lines

allow-hotplug eth0
iface eth0 inet dhcp


#allow-hotplug eth0
#iface eth0 inet dhcp

and add the fallowing line (assuming you want to have the ip address

auto eth0 #to run on start up
iface eth0 inet static #tel it to be static
address #the ip addess that you want to have
netmask #subnetmask
gateway #the ip address of your router

and for the dns you need to edit the file /etc/resolv.conf

nameserver #your routers dns
nameserver #or you can use googles dns

and filnally:

Now you can restart the computer or just run this command

sudo /etc/init.d/networking restart

if you want to get back to dhcp dynamic ip you can just run


if you had any more problems you can comment below and I would be more that happy to help