Skip to content

补充 Oracle Cloud 自动获取 IPv6 的方法 #77

@IRN-Kawakaze

Description

@IRN-Kawakaze

原因:
Oracle Cloud 在安装 Debian 之后会默认启用内核的IPv6转发功能(在其他服务器上未遇到过该现象),即:
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1

并且 Oracle Cloud 的 IPv6 默认网关是通过RA获取。

根据Linux 内核文档,在启用IPv6转发时,accept_ra需要为2才会接受RA。

accept_ra - INTEGER
	Accept Router Advertisements; autoconfigure using them.

	It also determines whether or not to transmit Router
	Solicitations. If and only if the functional setting is to
	accept Router Advertisements, Router Solicitations will be
	transmitted.

	Possible values are:
		0 Do not accept Router Advertisements.
		1 Accept Router Advertisements if forwarding is disabled.
		2 Overrule forwarding behaviour. Accept Router Advertisements
		  even if forwarding is enabled.

	Functional default: enabled if local forwarding is disabled.
			    disabled if local forwarding is enabled.

解决方法(二选一):
1、修改/etc/network/interfaces,启用IPv6的同时自动将网卡的accept_ra改为2:
(直接在/etc/sysctl.confnet.ipv6.conf.网卡名称.accept_ra的值可能会在重启networking时被覆盖,所以要在/etc/network/interfaces改)

iface 网卡名称 inet6 dhcp
    accept_ra 2

2、禁用IPv6转发:

$ echo 'net.ipv6.conf.all.forwarding = 0' >> /etc/sysctl.conf
$ sysctl --system

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions