首页 > 系统相关 >CentOS 7 关闭IPv6

CentOS 7 关闭IPv6

时间:2023-04-08 18:22:18浏览次数:54  
标签:CentOS GRUB image boot grub 关闭 IPv6 root localhost

一、编辑/etc/default/grub
编辑/etc/default/grub,在GRUB_CMDLINE_LINUX加上的后面句首加上ipv6.disable=1。
修改之前:

[root@localhost ~]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]# 

修改之后:

[root@localhost ~]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@localhost ~]#

二、重新生成grub.cfg文件
修改完毕后保存,运行grub2-mkconfig -o /boot/grub2/grub.cfg重新生成grub.cfg文件。

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.2.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.2.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.36.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.36.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-d885883cdb4944609bc5e3493dd2b680
Found initrd image: /boot/initramfs-0-rescue-d885883cdb4944609bc5e3493dd2b680.img
done
[root@localhost ~]#

三、重启系统
运行下面的命令,已经看不到tcp6的协议:

[root@localhost ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1030/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1294/master         
[root@localhost ~]# 
清除以前的防火墙规则,或者添加允许指定某个端口开放
[root@localhost ~]# iptables -F

 

标签:CentOS,GRUB,image,boot,grub,关闭,IPv6,root,localhost
From: https://www.cnblogs.com/huanglingfa/p/17298956.html

相关文章

  • ES搜索框架--ES部署到Centos8服务器
    参考:https://blog.csdn.net/Me_xuan/article/details/114608076https://www.cnblogs.com/chenxitag/p/12320868.html一、下载安装1.下载ES使用elasticsearch7.10.2,到官网下载对应的linux包,然后上传到服务器文件夹下,cd到文件夹后使用tar命令解压tar-xvfelasticsearch-7.10.2-linu......
  • Centos7 时间显示不对
    修改系统时区timedatectlset-timezoneAsia/Shanghai安装NTPyum-yinstallntp使用ntpdate更新系统时间ntpdatepool.ntp.org使用date查看时区是否正确date启动ntpddaemon,持续校准时间 systemctlstartntpd ......
  • Centos 7 安装部署 xxl-job
    1.xxl-job部署前需要的环境-Maven3+-Jdk1.8+-Mysql5.7+2.xxl-job下载地址官网地址https://www.xuxueli.com/xxl-job/源码地址https://github.com/xuxueli/xxl-job/3.在源码地址下载zip源码,下载项目源码并解压导入IDEA(maven要配置好阿里云的远程仓库,idea要配置好......
  • centos7 mongodb4.4分片集群部署
    #创建mongo相应的目录mkdir-pv/data/app/mongodb/confmkdir-pv/data/app/mongodb/{configset,shared1,shared2,shared3}/logmkdir-pv/data/mongodb/{configset,shared1,shared2,shared3}/data #创建于用户,给权限useradd-s/sbin/nologin-Mmongodchown-Rmong......
  • centos 7.9搭建安装confluence-7
    centos7.9搭建安装confluence-71、安装Java环境1.1解压tar包[root@wiki~]#tarxfjdk-8u171-linux-x64.tar.gz-C/usr/local/[root@wiki~]#mv/usr/local/jdk1.8.0_171/usr/local/jdk1.2配置java环境变量#配置java环境变量[root@wiki~]#sed-i.ori'$aexport......
  • Centos7 安装 maven3.6.3
    1.下载maven3.6.3安装包wgethttps://mirrors.ocf.berkeley.edu/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz--no-check-certificate2.创建一个安装maven的目录mkdir/usr/local/maven3.解压下载的软件包tar-zxvfapache-maven-3.6.3-bi......
  • Centos 7 安装 rabbitmq
    1.配置yum下载源:yuminstallepel-release-y2.下载rabbitmq:yuminstallrabbitmq-server-y3.配置webui网页插件(网页登陆端口号:15672)rabbitmq-pluginsenablerabbitmq_management4.启动rabbitmq-serversystemctlstartrabbitmq-server5.查看RabbitMq运行状态:......
  • Centos 7 yum 安装redis
    一、安装redis1、检查是否有redis yum 源yumlist|grepredis2、下载fedora的epel仓库yuminstallepel-release-y3、安装redis数据库yuminstallredis-y4.防火墙开放相应端口iptables-IINPUT-ptcp--dport6379-jACCEPT5.修改综合设置(用户名,密码,......
  • Centos8 配置本地yum源
    Centos8配置本地yum源centos8发行版通过BaseOS和应用流(AppStream)仓库发布,这篇文章主要介绍了CentOS8配置本地yum源的详细教程,需要的朋友可以参考下centos8发行版通过BaseOS和应用流(AppStream)仓库发布,AppStream是对传统rpm格式的全新扩展,为一个组件同时提供多个......
  • centos6更换源
    #备份原有文件[root@zk1/]#mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.repos.d/CentOS-Base.repo.backup#跳过检查证书,从https://www.xmpan.com/Centos-6-Vault-Aliyun.repo下载源[root@zk1/]#wget--no-check-certificate/etc/yum.repos.d/CentOS-Base.repohttps://w......