Linux 設定IPv6地址

來源:互聯網
上載者:User
文章目錄
  • 使用 "ip"
  • 使用 "ifconfig"
  • 使用 "ifconfig"
  • 使用 "ip"
  • 使用 "ifconfig"

   本本上Fedora 6的IPv6地址突然不見了,使用ifconfig怎麼配也配不上.

   #ifconfig eth0 inet6 add fe80::32ff:2abe:fe63:3eba/64  --無法載入
   #ifconfig eth0 inet6 add 3ffe::1/64   --無法載入
   
   使用lsmod,ipv6模組也被載入了,怎麼回事情不知道.

   後來,使用ip -6命令可以把ipv6地址載入上,包括Scope Link和Scope Global地址.

   使用以下命令:

      # /sbin/ip -6 addr add <ipv6address>/<prefixlength> dev <interface> 
     

   以下是全文:比較有用.

6. 設定IPv6地址6.1 列印當前的IPv6地址 使用 "ip"

使用方法:

# /sbin/ip -6 addr show dev <interface>

例子:一個靜態主機地址

# /sbin/ip -6 addr show dev eth02: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_ fast qlen 100inet6 fe80::210:a4ff:fee3:9566/10 scope linkinet6 3ffe:ffff:0:f101::1/64 scope globalinet6 fec0:0:0:f101::1/64 scope site 

自動設定的地址和它的存活時間:

# /sbin/ip -6 addr show dev eth0 3: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen? 100 inet6 2002:d950:f5f8:f101:2e0:18ff:fe90:9205/64 scope global dynamic valid_lft 16sec preferred_lft 6sec inet6 3ffe:400:100:f101:2e0:18ff:fe90:9205/64 scope global dynamic valid_lft 2591997sec preferred_lft 604797sec inet6 fe80::2e0:18ff:fe90:9205/10? scope link

使用 "ifconfig"

使用方法:

# /sbin/ifconfig <interface>

例子, 它只列印IPv6地址:

# /sbin/ifconfig eth0 |grep "inet6 addr:"inet6 addr: fe80::210:a4ff:fee3:9566/10 Scope:Linkinet6 addr: 3ffe:ffff:0:f101::1/64 Scope:Globalinet6 addr: fec0:0:0:f101::1/64 Scope:Site

6.2 增加一個IPv6地址

其原理同IPv4的"IP ALIAS"(IP別名)相同

使用 "ip"

使用方法:

# /sbin/ip -6 addr add <ipv6address>/<prefixlength> dev <interface> 

例子:

# /sbin/ip -6 addr add 3ffe:ffff:0:f101::1/64 dev eth0 

使用 "ifconfig"

使用方法:

# /sbin/ifconfig <interface> inet6 add <ipv6address>/<prefixlength>

例子:

# /sbin/ifconfig eth0 inet6 add 3ffe:ffff:0:f101::1/64 

6.3 移除IPv6地址

這個不常用, 不要用它移除不存在的地址, 一些早期的核心會因為受不了而掛掉.

使用 "ip"

使用方法:

# /sbin/ip -6 addr del <ipv6address>/<prefixlength> dev <interface> 

例子:

# /sbin/ip -6 addr del 3ffe:ffff:0:f101::1/64 dev eth0 

使用 "ifconfig"

使用方法:

# /sbin/ifconfig <interface> inet6 del <ipv6address>/<prefixlength>

例子:

# /sbin/ifconfig eth0 inet6 del 3ffe:ffff:0:f101::1/64

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.