How to disable IPv6 in CentOS

Source: Internet
Author: User

How to disable IPv6 in CentOS

Disable IPv6

1. problem: when using yum to download something, the system prompts that an IPv6 address is inaccessible, as shown below:

Failed [Errno 14] pycurl error 7-"Failed to connect to 2001: da8: 8000: 6023: Network is unreachable"

Trying other mirror.

Error: failure: repodata/logs from epel: [Errno 256] No more mirrors to try.

You cocould try using -- skip-broken to work around the problem

You cocould try running: rpm-Va -- nofiles -- nodigest

2. Check the NIC configuration of the Local Machine. ipv6 inet6 is indeed enabled on eth2.

[Root @ lvs05091 ~] # Ifconfig-

Eth2 Link encap: Ethernet HWaddr 00: 50: 56: A5: 2F: 9D

Inet addr: 192.168.5.91 Bcast: 192.168.5.255 Mask: 255.255.255.0

Inet6 addr: fe80 :: 250: 56ff: fea5: 2f9d/64 Scope: Link

Up broadcast running multicast mtu: 1500 Metric: 1

RX packets: 522 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 138 errors: 0 dropped: 0 overruns: 0 carrier: 0

Collisions: 0 FIG: 1000

RX bytes: 42263 (41.2 KiB) TX bytes: 19212 (18.7 KiB)

[Root @ lvs05091 modprobe. d] # netstat-

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State

Tcp 0 0: 111: * LISTEN

Tcp 0 0: 22: * LISTEN

Tcp 0 0: 1: 25: * LISTEN

Tcp 0 0: 37256: * LISTEN

: IPv6

3. Disable IPv6

Modify the sysctl. conf configuration file and add the following content:

[Root @ lvs05091 etc] # vi sysctl. conf

# Shutdown IPv6

Net. ipv6.conf. all. disable_ipv6 = 1

Net. ipv6.conf. default. disable_ipv6 = 1

Is to modify the configuration to take effect

[Root @ lvs05091 etc] # sysctl-p

Restart NIC: service network restart

Note: IPv6 is permanently disabled.

It can also be disabled at zero time. IPv6 will be enabled next time.

Echo 1>/proc/sys/net/ipv6/conf/all/disable_ipv6

Echo 1>/proc/sys/net/ipv6/conf/default/disable_ipv6

4. Check the interface configuration to see that the ipv6 address is no longer in use.

[Root @ lvs05091 etc] # ifconfig-

Eth2 Link encap: Ethernet HWaddr 00: 50: 56: A5: 2F: 9D

Inet addr: 192.168.5.91 Bcast: 192.168.5.255 Mask: 255.255.255.0

Up broadcast running multicast mtu: 1500 Metric: 1

RX packets: 2336 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 839 errors: 0 dropped: 0 overruns: 0 carrier: 0

In this case, it is normal to use yum to download things.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.