阅读更多
查看端口:
donald_draper@rain:~$ netstat -ntlp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN -
tcp6 0 0 ::1:631 :::* LISTEN -
查看ipv6状态:
#显示0说明ipv6开启,1说明关闭
donald_draper@rain:~$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6
0
在 /etc/sysctl.conf 增加下面几行
#disable IPv6
donald_draper@rain:~$ sudo vim /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
donald_draper@rain:~$ tail -n 3 /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
将文件中的 GRUB_CMDLINE_LINUX_DEFAULT="quiet spalsh" 修改为
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
donald_draper@rain:~$ sudo vim /etc/default/grub
donald_draper@rain:~$ cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"
GRUB_CMDLINE_LINUX=""
运行sudo update-grub更新
donald_draper@rain:~$ sudo update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.2.0-16-generic
Found initrd image: /boot/initrd.img-4.2.0-16-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
重启网络服务,禁用ipv6成功
donald_draper@rain:~$ netstat -ntup
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:47154 127.0.0.1:631 ESTABLISHED -
tcp 0 0 127.0.0.1:47156 127.0.0.1:631 ESTABLISHED -
tcp 0 0 127.0.0.1:631 127.0.0.1:47156 ESTABLISHED -
tcp 0 0 127.0.0.1:631 127.0.0.1:47154 ESTABLISHED -
donald_draper@rain:~$ ifconfig
eno16777736 Link encap:Ethernet HWaddr 00:0c:29:39:44:61
inet addr:192.168.126.135 Bcast:192.168.126.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:104 errors:0 dropped:0 overruns:0 frame:0
TX packets:48 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8278 (8.2 KB) TX bytes:5534 (5.5 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:213 errors:0 dropped:0 overruns:0 frame:0
TX packets:213 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18820 (18.8 KB) TX bytes:18820 (18.8 KB)
关于SSH IP6关闭,参见:
https://www.jb51.net/LINUXjishu/335724.html
还有一个cups的打印服务关闭:
参见:
https://unix.stackexchange.com/questions/177458/remove-cupsd-completly