Jump to content

Ubuntu:Teknik Mengkonfigurasi IP address: Difference between revisions

From Wiki
No edit summary
 
Line 1: Line 1:
==Ubuntu 20.04==
==Ubuntu 20.04==
Edit
Edit
vi /etc/netplan/00-installer-config.yaml
 
<syntaxhighlight lang="bash">
vim /etc/netplan/00-installer-config.yaml
</syntaxhighlight>
 
Contoh isi:
Contoh isi:
<syntaxhighlight lang="bash">
  # This is the network config written by 'subiquity'
  # This is the network config written by 'subiquity'
  network:
  network:
Line 18: Line 24:
       nameservers:
       nameservers:
         addresses: [192.168.20.2, 8.8.8.8]
         addresses: [192.168.20.2, 8.8.8.8]
</syntaxhighlight>
Kemudian lakukan
Kemudian lakukan
sudo netplan apply
 
sudo reboot
<syntaxhighlight lang="bash">
sudo netplan apply
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
sudo reboot
</syntaxhighlight>
 
==Ubuntu <18.04==
==Ubuntu <18.04==
Edit file /etc/network/interfaces
Edit file /etc/network/interfaces
# vi /etc/network/interfaces
 
<syntaxhighlight lang="bash">
vim /etc/network/interfaces
</syntaxhighlight>
 
Contoh isi
Contoh isi


'''IP Dynamic'''
'''IP Dynamic'''
iface eth0 inet dhcp
 
<syntaxhighlight lang="bash">
iface eth0 inet dhcp
</syntaxhighlight>
 
'''IP Static'''
'''IP Static'''
iface eth0 inet static
<syntaxhighlight lang="bash">
address 192.168.0.2
iface eth0 inet static
netmask 255.255.255.0
address 192.168.0.2
gateway 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.1
</syntaxhighlight>
 
==IPv6==
==IPv6==
<syntaxhighlight lang="bash">
  ### Start IPV6 static configuration
  ### Start IPV6 static configuration
  iface eth0 inet6 static
  iface eth0 inet6 static
Line 41: Line 68:
  gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
  gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
  ### END IPV6 configuration
  ### END IPV6 configuration
</syntaxhighlight>


== Source ==
== Source ==
* [https://lms.onnocenter.or.id/wiki/index.php/Teknik_Mengkonfigurasi_IP_address onnocenter.or.id]
* [https://lms.onnocenter.or.id/wiki/index.php/Teknik_Mengkonfigurasi_IP_address onnocenter.or.id]



Latest revision as of 21:25, 23 November 2022

Ubuntu 20.04

Edit

vim /etc/netplan/00-installer-config.yaml

Contoh isi:

 # This is the network config written by 'subiquity'
 network:
   ethernets:
     enp0s3:
       dhcp4: true
   version: 2
Untuk IP Static
 network:
   version: 2
   ethernets:
     enp0s3:
       addresses: [192.168.20.160/24]
       gateway4: 192.168.20.2
       nameservers:
         addresses: [192.168.20.2, 8.8.8.8]

Kemudian lakukan

sudo netplan apply
sudo reboot

Ubuntu <18.04

Edit file /etc/network/interfaces

vim /etc/network/interfaces

Contoh isi

IP Dynamic

iface eth0 inet dhcp

IP Static

iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1

IPv6

 ### Start IPV6 static configuration
 iface eth0 inet6 static
 pre-up modprobe ipv6
 address 2607:f0d0:2001:000a:0000:0000:0000:0010
 netmask 64
 gateway 2607:f0d0:2001:000a:0000:0000:0000:0001
 ### END IPV6 configuration

Source