Author Topic: netplan in ubuntu 18.04_LTS-server  (Read 3665 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
netplan in ubuntu 18.04_LTS-server
« on: มกราคม 16, 2019, 08:15:36 PM »
การปรับแต่ง networking configure รูปแบบใหม่ใน ubuntu18.04

vi /etc/netplan/01-netcfg.yaml

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: yes
      mtu: 9000
    eno2:
      dhcp4: yes
      mtu: 9000

จากตัวอย่างเป็นการตั้งค่า dhcp ที่เป้น ipv4 ให้กับ interface : eno1 และ eno2
พร้อมทั้งตั้งเป็น MTU9000 จากเดิม 1500 เพื่อเพิ่มประสิทธิภาพให้กับ traffic ที่ดีขึ้น 20% 

หลังจากที่ configure เสร็จก็สั่ง try ก่อน
#netplan try
กด enter เพื่อ confirm

#ifconfig -a

แล้วทำการ apply โดย
#netplan apply
ก็เป็นอันตั้งค่า network แบบ dhcp4 ให้กับเครื่อง ubuntu18.04 เรียบร้อยครับ

ทีมงาน Packetlove[dot]Com  ;)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: netplan in ubuntu 18.04_LTS-server
« Reply #1 on: มกราคม 16, 2019, 08:20:22 PM »
ในกรณีต้องตั้งค่าเป็น static ip ก็จัดได้เลยดังนี้

vi /etc/netplan/01-netcfg.yaml

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
    version: 2
    renderer: networkd
    ethernets:
       ens5:
       dhcp4: no
       addresses: [192.168.1.230/24]
       gateway4: 192.168.1.254
       nameservers:
          addresses: [8.8.4.4,8.8.8.8]

#netplan try
กด enter เพื่อ confirm

#ifconfig -a

แล้วทำการ apply โดย
#netplan apply