Friday, May 11, 2018

How to set static IP address in Debian/Linux

#su root
password *****
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:15:5d:03:0e:04
          inet addr:10.0.3.107  Bcast:255.255.255.255  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fe03:e04/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:465305 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533020 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:498809052 (475.7 MiB)  TX bytes:55438709 (52.8 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:30244 errors:0 dropped:0 overruns:0 frame:0
          TX packets:30244 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1827643 (1.7 MiB)  TX bytes:1827643 (1.7 MiB)
# nano /etc/network/interfaces
 Read like this
allow-hotplug eth0           
iface eth0 inet static
        address 10.0.3.106
        netmask 255.255.255.0
        gateway 10.0.3.1
# ifdown eth0
# ifup eth0
# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:15:5d:03:0e:04
          inet addr:10.0.3.106  Bcast:10.0.3.255  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fe03:e04/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:466427 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533321 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:499006171 (475.8 MiB)  TX bytes:55476220 (52.9 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:32474 errors:0 dropped:0 overruns:0 frame:0
          TX packets:32474 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1956969 (1.8 MiB)  TX bytes:1956969 (1.8 MiB)
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=44 time=47.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=44 time=47.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=44 time=49.4 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=44 time=47.3 ms
Ctrl+C to stop run stop ping
if you ping 8.8.8.8 fail use command this
# nano /etc/resolv.conf
read like this
nameserver 10.0.3.1

Related Posts

How to set static IP address in Debian/Linux
4/ 5
Oleh

Recent