Perintah dasar networking distro Linux Ubuntu dalam modus CLI (command-line)

# Mengaktifkan dan menonaktifkan interface ethernet secara manual
## Untuk mengaktifkan interface eth0

sysadmin@dserv:~$ sudo ifup eth0

## Untuk menonaktifkan interface eth0

sysadmin@dserv:~$ sudo ifdown eth0

# Untuk menampilkan interface yg terdeteksi oleh system:

sysadmin@dserv:~$ sudo ifconfig -a | grep eth
eth0      Link encap:Ethernet  HWaddr 24:b6:fd:f5:78:68
eth1      Link encap:Ethernet  HWaddr 24:b6:fd:f5:78:69
eth2      Link encap:Ethernet  HWaddr 24:b6:fd:f5:78:6a
eth3      Link encap:Ethernet  HWaddr 24:b6:fd:f5:78:6b
sysadmin@dserv:~$

# Bisa juga dengan cara:

sysadmin@dserv:~$ sudo lshw -class network
*-network:0
description: Ethernet interface
product: NetXtreme BCM5720 Gigabit Ethernet PCIe
vendor: Broadcom Corporation
physical id: 0
bus info: pci@0000:01:00.0
logical name: eth0
version: 00
serial: 24:b6:fd:f5:78:68
size: 1Gbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
.........................
sysadmin@dserv:~$

# ‘ethtool‘, sebuah program untuk menampilkan dan merubah konfigurasi interface ethernet, seperti ‘auto-negotiation’, ‘port-speed’, ‘duplex mode’, dan ‘wake-on’lan’, tapi secara default belum terinstall, tapi program tsb dapat di install dari repositori.

sysadmin@dserv:~$ sudo ethtool eth0
Settings for eth0:
Supported ports: [ TP ]
Supported link modes:   10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: g
Wake-on: d
Current message level: 0x000000ff (255)
drv probe link timer ifdown ifup rx_err tx_err
Link detected: yes
sysadmin@dserv:~$

# Pengalamatan IP
## perintah berikut hanya akan merubah IP Address secara sementara, ketika system di restart, maka konfigurasi akan kembali ke semula.

# Memberi IP Address untuk interface eth0

sysadmin@dserv:~$ sudo ifconfig eth0 192.168.6.2 netmask 255.255.255.0

# lihat hasilnya:

sysadmin@dserv:~$ sudo ifconfig
eth0      Link encap:Ethernet  HWaddr 24:b6:fd:f5:78:68
inet addr:192.168.6.2  Bcast:192.168.6.255  Mask:255.255.255.0
inet6 addr: fe80::26b6:fdff:fef5:7868/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:7448 errors:0 dropped:0 overruns:0 frame:0
TX packets:6212 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10019387 (10.0 MB)  TX bytes:546386 (546.3 KB)
Interrupt:35
sysadmin@dserv:~$

# Gunakan perintah ‘route’ untuk menambahkan default gateway.

sysadmin@dserv:~$ sudo route add default gw 192.168.6.1 eth0

# Lihat hasilnya:

sysadmin@dserv:~$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.6.1     0.0.0.0         UG    100    0        0 eth0
192.168.6.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
sysadmin@dserv:~$

# Untuk menambahkan IP DNS Server, bisa menambahkan baris seperti berikut di dalam file ‘/etc/resolv.conf’.

search virtual.domain
nameserver 8.8.8.8
nameserver 192.168.6.2

# Jika kalian tidak memerlukan konfigurasi sementara ini, gunakan perintah ‘ip’.

sysadmin@dserv:~$ sudo ip addr flush eth0

## Setting IP Address Ubuntu secara permanen ##
# Edit file ‘/etc/network/interfaces
## Untuk IP Address Static

sysadmin@dserv:~$ sudo nano /etc/network/interfaces

## Berikut isi file /etc/network/interfaces ##

# 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

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.6.2
netmask 255.255.255.0
network 192.168.6.0
broadcast 192.168.6.255
gateway 192.168.6.1
# dns-* options are implemented by the resolvconf package, if installed
dns-search virtual.domain

## Untuk IP Address dinamis

## Berikut isi file /etc/network/interfaces ##

# 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

# The primary network interface
auto eth0
iface eth0 inet dhcp

# Merubah statik hostname
## Format penulisannya adalah:

IP-Address    FQDN    hostname
sysadmin@dserv:~$ sudo nano /etc/hosts

## Berikut isi file /etc/hosts ##
127.0.0.1       localhost
192.168.6.2     dserv.virtual.domain   dserv

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

## Jangan lupa, setiap kali melakukan perubahan konfigurasi, service networking harus di restart.

sysadmin@dserv:~$ sudo /etc/init.d/networking restart

Referensi: Ubuntu help
+========Semoga {:|:} Membantu======+

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: