0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Linuxでipv6を無効化してipv4通信を優先したい

Last updated at Posted at 2023-12-24

環境情報

  • MIRACLE LINUX release 8.9

ipv6が優先されていることを確認

# ping localhost
PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.106 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.042 ms
64 bytes from localhost (::1): icmp_seq=4 ttl=64 time=0.025 ms

grub設定でipv6を無効化

ipv6.disable=1を追加

# vim /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 resume=/dev/mapper/ml-swap rd.lvm.lv=ml/root rd.lvm.lv=ml/swap rhgb quiet ipv6.disable=1"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

grubファイルの設定反映

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

サーバ再起動

# reboot

ipv4が優先されていることを確認

# ping localhost
PING localhost(localhost (127.0.0.1)) 56 data bytes
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.106 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.040 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.042 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.025 ms
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?