Trước đây khi cài đặt app bằng Helper Scripts, mình thường tắt tính năng IPv6 vì không có nhu cầu sử dụng. Nhưng giờ do mạng ở nhà đã được hỗ trợ IPv6 nên cần kích hoạt lại IPv6 cho LXC Container.

1. Kích hoạt IPv6 cho Debian LXC

Kiểm tra IPv6

ip addr | grep inet6Code language: Nginx (nginx)

Nếu không thấy hiện ra kết quả gì nghĩa là IPv6 đang bị vô hiệu hóa.

Chỉnh sửa file này

nano /etc/sysctl.confCode language: Nginx (nginx)

Kéo xuống cuối cùng, nếu thấy dòng net.ipv6.conf.all.disable_ipv6 = 1 thì xóa nó đi và lưu lại.

Khởi động lại LXC bằng lệnh reboot

Giờ kiểm tra lại bằng lệnh ip addr | grep inet6, sẽ thấy hiện ra 1 loạt kết quả

    inet6 ::1/128 scope host noprefixroute 
    inet6 2405:6587:xxxx:yyyy:be24:11ff:feee:b784/64 scope global dynamic mngtmpaddr 
    inet6 fe80::be24:11ff:feee:b784/64 scope link 
    inet6 fd7a:115c:a1e0::5001:a610/128 scope global 
    inet6 fe80::e100:2cd1:2da:c9a/64 scope link stable-privacy 
    inet6 fe80::42:9ff:fe28:332c/64 scope link 
    inet6 fe80::42:13ff:feac:de49/64 scope link 
    inet6 fe80::42:55ff:fece:14d6/64 scope link 
    inet6 fe80::600b:90ff:fee7:de2b/64 scope link 
    inet6 fe80::787b:fff:fe28:f77a/64 scope link 
    inet6 fe80::8084:7eff:fedd:9b0d/64 scope link 
    inet6 fe80::508b:d4ff:feaa:7f5b/64 scope link 
    inet6 fe80::80b9:e3ff:fe40:9f22/64 scope link 
Code language: PHP (php)

Trong đó dòng số 2 chính là Public IPv6 của em LXC này.

inet6 2405:6587:xxxx:1300:yyyy:11ff:feee:b784/64 scope global dynamic mngtmpaddr Code language: PHP (php)

2. Kích hoạt IPv6 cho Ubuntu LXC

Kiểm tra IPv6

ip addr | grep inet6Code language: Nginx (nginx)

thì chỉ thấy hiện ra Local IPv6

    inet6 ::1/128 scope host 
    inet6 fe80::be24:11ff:fee3:cd74/64 scope link Code language: PHP (php)

Chỉnh sửa file /etc/systemd/network/eth0.network, đổi giá trị của mục IPv6AcceptRA từ false thành true

[Match]
Name = eth0

[Network]
Description = Interface eth0 autoconfigured by PVE
Address = 192.168.0.206/24
Gateway = 192.168.0.1
DHCP = no
IPv6AcceptRA = trueCode language: YAML (yaml)

Tạo thêm 1 file .pve-ignore.eth0.network để ngăn Proxmox tự động đổi giá trị IPv6AcceptRA thành lại thành false mỗi khi khởi động LXC.

touch /etc/systemd/network/.pve-ignore.eth0.networkCode language: Nginx (nginx)

Khởi động lại LXC

reboot

Kiểm tra lại, IPv6 đã hiện ra ngon lành.

    inet6 2405:6587:xxxx:yyyy:be24:11ff:fee3:cd74/64 scope global dynamic mngtmpaddr noprefixroute Code language: PHP (php)

Tham khảo:No IPV6 for LXC container | Proxmox Support Forum

Theo dõi
Thông báo của
guest
2 Comments
Cũ nhất
Mới nhất Được bỏ phiếu nhiều nhất
Phản hồi nội tuyến
Xem tất cả bình luận