photo lineviral_1.png

Cli Ifconfig – How To Setup Ip Addess From Ascendency Trouble Inward Linux

Did yous fifty-fifty had problem alongside Network Manager or ifconfig in addition to felt that yous demand to endeavour to laid upward static IP address from ascendancy employment / CLI ifconfig? I accidentally removed Gnome (my bad, wasn’t paying attending in addition to did an apt-get autoremove -y .. how bad is that.. ) So I had a problem, I can’t connect to Internet to reinstall my Gnome Network Manager motility I’m inwards TEXT mode. Similarly I broke my network managing director motility I was trying to role VPN in addition to it simply wouldn’t come upward back. I tried reinstalling it, but yous demand Internet for that. So here’s a modest guide for that yous tin setup IP address in addition to networking from Linux Command Line or CLI. You’ll hold out able to  browse it from your mobile device in addition to brand things work.

Did yous fifty-fifty had problem alongside Network Manager or ifconfig in addition to felt that yous demand to endeavour to CLI ifconfig – How to setup IP addess from Command Line inwards Linux

Firstly STOP in addition to START Networking service


Some people would fighting restart would work, but I prefer STOP-START to create a consummate rehash. Also if it’s non working already, why bother?


# /etc/init.d/networking stop
[ ok ] Deconfiguring network interfaces...done.
# /etc/init.d/networking start
[ ok ] Configuring network interfaces...done.

STOP in addition to START Network-Manager


If yous accept another network managing director (i.e. wicd, therefore commencement halt that one).


# /etc/init.d/network-manager stop
[ ok ] Stopping network connecter manager: NetworkManager.
# /etc/init.d/network-manager start
[ ok ] Starting network connecter manager: NetworkManager.

Just for the kicks, next is what restart would do.. like I nonetheless prefer stop/start combination.


 # /etc/init.d/network-manager restart
[ ok ] Stopping network connecter manager: NetworkManager.
[ ok ] Starting network connecter manager: NetworkManager.

Now to convey upward your interface:


 # ifconfig eth0 up
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr aa:bb:cc:11:22:33
UP BROADCAST MULTICAST  MTU:1500  Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Now lets laid IP, subnet mask, broadcast address.


 # ifconfig eth0 192.168.43.226
# ifconfig eth0 netmask 255.255.255.0
# ifconfig eth0 broadcast 192.168.43.255

Let banking company fit the outcome:


# ifconfig eth0
eth0     Link encap:Ethernet  HWaddr aa:bb:cc:11:22:33
inet addr:192.168.43.226  Bcast:192.168.43.255  Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:19325 errors:0 dropped:0 overruns:0 frame:0
TX packets:19641 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

and endeavour to ping Google.com (cause if google.com is down, Internet is broken).


# ping google.com
ping: unknown host google.com

Ah Internet is broken. Maybe not! So what went incorrect inwards our side.


Simple, nosotros didn’t add together whatever default Gateway. Let’s create that


# route add together default gw 192.168.43.1 eth0

and Just to confirm:


# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.43.1    0.0.0.0         UG    0      0        0 eth0
192.168.43.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

Looks adept to me, lets ping google.com again:


# ping google.com
PING google.com (119.30.40.16) 56(84) bytes of data.
64 bytes from cache.google.com (119.30.40.16): icmp_req=1 ttl=49 time=520 ms
64 bytes from cache.google.com (119.30.40.16): icmp_req=2 ttl=49 time=318 ms
64 bytes from cache.google.com (119.30.40.16): icmp_req=3 ttl=49 time=358 ms
64 bytes from cache.google.com (119.30.40.16): icmp_req=4 ttl=49 time=315 ms
^C
--- google.com ping statistics ---
four packets transmitted, four received, 0% bundle loss, fourth dimension 3002ms
rtt min/avg/max/mdev = 315.863/378.359/520.263/83.643 ms

That’s it. Thanks for reading, create share.


Buat lebih berguna, kongsi:
close