设为首页 收藏本站
查看: 478|回复: 0

[经验分享] Red Hat / CentOS IPv6 Network Configuration

[复制链接]

尚未签到

发表于 2016-5-10 08:15:06 | 显示全部楼层 |阅读模式
  


Red Hat / CentOS IPv6 Network Configuration

by VIVEK GITE on JANUARY 23, 2009 · 15 COMMENTS


Q. How do I
configure static IPv6 networking under RHEL 5.x / Fedora / CentOS Linux?
<!--[if !supportLineBreakNewLine]-->
<!--[endif]-->


A. Red Hat
/ CentOS / Fedora RHEL support IPv6 out of box. All you have to do is update
two files and turn on networking.
You need to update and
configure following files for IPv6 configuration:
<!--[if !supportLists]-->1.    
<!--[endif]-->/etc/sysconfig/network : Turn
on networking in this file.
<!--[if !supportLists]-->2.    
<!--[endif]-->/etc/sysconfig/network-scripts/ifcfg-eth0 : Set
default IPv6 router IP and server IP address in this file.
Open
/etc/sysconfig/network file, enter:
# vi /etc/sysconfig/network

Append following line:

NETWORKING_IPV6=yes


Open
/etc/sysconfig/network-scripts/ifcfg-eth0 (1st network config file)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append following config directives for IPv6:

IPV6INIT=yes
IPV6ADDR=<IPv6-IP-Address>
IPV6_DEFAULTGW=<IPv6-IP-Gateway-Address>


Here is my sample file
with mix of IPv4 and IPv6 assigned to eth0:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
HWADDR=00:30:48:33:bc:33
IPADDR=202.54.1.5
GATEWAY=202.54.1.3
NETMASK=255.255.255.248
IPV6INIT=yes
IPV6ADDR=2607:f0d0:1002:0011:0000:0000:0000:0002
IPV6_DEFAULTGW=2607:f0d0:1002:0011:0000:0000:0000:0001


Where,
<!--[if !supportLists]-->§  <!--[endif]-->NETWORKING_IPV6=yes|no - Enable
or disable global IPv6 initialization.
<!--[if !supportLists]-->§  <!--[endif]-->IPV6INIT=yes - Enable
or disable IPv6 configuration for all interfaces.
<!--[if !supportLists]-->§  <!--[endif]-->IPV6ADDR=2607:f0d0:1002:0011:0000:0000:0000:0002 -
Specify a primary static IPv6 address here.
<!--[if !supportLists]-->§  <!--[endif]-->IPV6_DEFAULTGW=2607:f0d0:1002:0011:0000:0000:0000:0001 - Add a
default route through specified gateway.
Save
and close the file. Restart networking:
# service network restart

Verify your configuration by pinging ipv6 enabled site such as ipv6.google.com:
$ ping6 ipv6.google.com

Sample output:

PING ipv6.google.com(2001:4860:b002::68) 56 data bytes
64 bytes from 2001:4860:b002::68: icmp_seq=1 ttl=59 time=93.2 ms
64 bytes from 2001:4860:b002::68: icmp_seq=2 ttl=59 time=95.0 ms
64 bytes from 2001:4860:b002::68: icmp_seq=3 ttl=59 time=94.2 ms
64 bytes from 2001:4860:b002::68: icmp_seq=4 ttl=59 time=95.2 ms
64 bytes from 2001:4860:b002::68: icmp_seq=5 ttl=59 time=94.8 ms
64 bytes from 2001:4860:b002::68: icmp_seq=6 ttl=59 time=95.1 ms
64 bytes from 2001:4860:b002::68: icmp_seq=7 ttl=59 time=93.3 ms
64 bytes from 2001:4860:b002::68: icmp_seq=8 ttl=59 time=93.8 ms
--- ipv6.google.com ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7010ms
rtt min/avg/max/mdev = 93.268/94.376/95.268/0.799 ms


Traces
path to a network host, enter:
$ traceroute6 ipv6.google.com

Print default IPv6 routing table, enter:
$ route -n -A inet6

Sample output:

Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
::1/128                                     ::                                      U     0      42531       1 lo
::62.41.14.144/128                          ::                                      U     0      0        1 lo
::127.0.0.1/128                             ::                                      U     0      0        1 lo
::/96                                       ::                                      U     256    0        0 sit0
2001:470:1f04:55a::2/128                    ::                                      U     0      15201       1 lo
2001:470:1f04:55a::/64                      ::                                      U     256    0        0 sit1
fe80::4833:22f4/128                         ::                                      U     0      0        1 lo
fe80::212:3fff:fe75:fa0d/128                ::                                      U     0      0        1 lo
fe80::/64                                   ::                                      U     256    0        0 eth0
fe80::/64                                   ::                                      U     256    0        0 sit1
ff00::/8                                    ::                                      U     256    0        0 eth0
ff00::/8                                    ::                                      U     256    0        0 sit1
::/0                                        ::                                      U     1      0        0 sit1


Once
IPv6 configured properly, you need to setup IPv6
firewall using ip6tables command under
Linux.

Featured Articles:

<!--[if !supportLists]-->§  <!--[endif]-->20 Linux
System Monitoring Tools Every SysAdmin Should Know
<!--[if !supportLists]-->§  <!--[endif]-->20 Linux
Server Hardening Security Tips
<!--[if !supportLists]-->§  <!--[endif]-->My 10
UNIX Command Line Mistakes
<!--[if !supportLists]-->§  <!--[endif]-->Linux:
20 Iptables Examples For New SysAdmins 

<!--[if !supportLists]-->§  <!--[endif]-->25 PHP
Security Best Practices For Sys Admins
<!--[if !supportLists]-->§  <!--[endif]-->The
Novice Guide To Buying A Linux Laptop
<!--[if !supportLists]-->§  <!--[endif]-->10
Greatest Open Source Software Of 2009
<!--[if !supportLists]-->§  <!--[endif]-->Top 5
Email Client For Linux, Mac OS X, and Windows Users
<!--[if !supportLists]-->§  <!--[endif]-->Top 20
OpenSSH Server Best Security Practices
<!--[if !supportLists]-->§  <!--[endif]-->Top 10
Open Source Web-Based Project Management Software
<!--[if !supportLists]-->§  <!--[endif]-->Top 5
Linux Video Editor Software
Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 15 comments…
read them below or add one }

1Sean June 15, 2010



you
have no ipv6 mask :(
REPLY



2Beau July 13, 2010



Thanks
so much for this article. It is exactly what I have been looking for. I will
recommend this article. Keep up the good work.
REPLY



3Pete July 15, 2010



Nice
reminders, but I’d like to make two suggestions:
1.
Since the gateways are not specific to an interface, I keep the default gateway
stuff (v4 and v6) in /etc/sysconfig/network.
2.
I also don’t like the v6 autoconf for servers, so I turn it off in
/etc/sysconfig/network: IPV6_AUTOCONF=no
Thanks
for the quick tips.
Pete
REPLY



4Steve September 27, 2010



So
how would one find out there IPV6 address to use as a static one and what the
default gw IPV6 address us to use?
I
know the IPV4 addresses > how do i find its IPV6?
Thanks
in advance
REPLY



5SH October 7, 2010



I
try to add another interface (ifcfg-eth0:1) with the same IPv6 lines as in
ifcfg-eth0, but the IPv6 does not appear when I use ifconfig. How can I assign
an IPv6 to another network interface?
REPLY



6Pete October 7, 2010



Use
IPV6ADDR_SECONDARIES in ifcfg-eth0. Generally, v6 devices expect to have
multiple addresses. If you do an ifconfig on eth0, you’ll probably see at least
two v6 addresses already (one a link-local scope and one a global scope).
IPV6ADDR_SECONDARIES=”[/]
…” (optional)

A list of secondary IPv6 addresses (e.g. useful for virtual hosting)

Example:

IPV6ADDR_SECONDARIES=”3ffe:ffff:0:1::10 3ffe:ffff:0:2::11/128″
REPLY



7S!FE October 20, 2010



Is
there any directive to make network service start at boot time.
REPLY



8Vivek Gite October 20, 2010



Try

 chkconfig network on


REPLY

9S!FE October 20, 2010



I
think that works for me, thanks Mr Vivek.
REPLY



10tomas November 16, 2010



Just a question. How can
I calculate usable hosts address? I have assigned IPv6 /48 network and need
single adress for each server, for example

3x IPv6 address for server-1

2x IPv6 address for server-2

etc …
REPLY



11Joel Snyder February 27, 2011



ipv6.google.com doesn’t
resolve today, so it’s a bad example. Try http://www.v6.facebook.com.
REPLY



12Monster June 10, 2011



any
idea how to configure IPv6 in bridge for RH based OS?
REPLY



13Iain Kay July 22, 2011



I
have a question. If one has setup a CentOS server, and it is now in production
sitting online in use 24/7 with IPv4, is it possible to add IPv6 to it without
having to restart the network service?
What I have tried:

$ modprobe ipv6

$ ifconfig eth0 && ifconfig xenbr0
By
this point there are no ipv6 addresses shown in ifconfig
$
ip addr add 2001:xx:xx:xx:1::2/64 dev xenbr0
By this point I still
have no ipv6 addresses in ifconfig, all I get is:

RTNETLINK answers: Operation not supported
If
I absolutely have to reboot the server then I will find a good point to do so
and do it but if it’s even remotely possible to do without then that would be
ideal. The server hosts Xen virtual machines using bridged networking
configuration and somehow I doubt that restarting the network service would
play nice with them and come back automatically at Virtual Machine level.
REPLY



14George October 17, 2011



Hi
I dont find /etc/sysconfig/network-scripts/ifcfg-eth0, I only have
/etc/sysconfig/network-scripts/ifcfg-lo…….what can I do ? Help me please
REPLY



15Calum November 2, 2011



George
– how about cp /etc/sysconfig/network-scripts/ifcfg-lo
/etc/sysconfig/network-scripts/ifcfg-eth0



 

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-214896-1-1.html 上篇帖子: 修改CentOS系统的默认启动级别 下篇帖子: CentOS安装之后的系统安全配置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表