3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

OpenWrt 22.03 23.05 FW4 V6プラス & IPv6オプション + ニチバン対策 旧版

Last updated at Posted at 2023-07-27

こちらに統合しました

BASH版

  • 軽量なbash版に移行しました
    ※ 375kB + α

はじめに

初心者対応構成

  • スクリプトでの自動設定
  • UCIとLuCi及びWinSCPにて比較しながら作業がおススメ

PowerShellSSHアクセス

ssh root@192.168.1.1
ssh root@192.168.1.1のショートカット作成(デスクトップ)
powershell
$DESKTOP = ([Environment]::GetFolderPath("Desktop") + "\192.168.1.1.lnk")
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$DESKTOP")
$Shortcut.TargetPath = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
$Shortcut.Arguments = '-windowstyle hidden -ExecutionPolicy RemoteSigned "Start-Process ssh root@192.168.1.1"'
$Shortcut.IconLocation = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe,0"
$Shortcut.WorkingDirectory = "."
$Shortcut.Save()

  • 強制的に貼り付け
  • yes

SSHログイン出来ない場合:exclamation:

known_hostsクリア

  • C:\Users\yourusername\.ssh\known_hosts ※Windows隠しファイル
powershell
Clear-Content .ssh\known_hosts -Force


OpenSSHのインストール
※Windows 10 Fall Creators Update(1709)以降標準搭載

  • 機能の確認
powershell
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH*'

  • 機能のインストール
powershell
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0


対応回線

自動設定 : 回線直結全自動構成

構成 (ニチバン対策含む) ※ 要ONU直結

インストール

# package
opkg update
opkg install map

reboot

OPTION値確認

# web-config-software
wget --no-check-certificate -O /www/map-e.html https://raw.githubusercontent.com/site-u2023/config-software/main/map-e.html

# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan6 NET_IF6
network_get_ipaddr6 NET_ADDR6 "${NET_IF6}"
sed -i -e "s/IPv6ADDRESS/${NET_ADDR6}/g" /www/map-e.html

  • 以下を開く
    web-config-software
  • 計算をクリック ※ 値は入力済み
  • 以下の値を確認
    • option_ipaddr
    • option_ip4prefixlen
    • option_ip6prefix
    • option_ip6prefixlen
    • option_ealen
    • option_psidlen
    • option_offset

設定値入力

  • 以下にconfig-softwareで確認したoption値を入力
# option値
option_ipaddr=         # 例 : option_ipaddr=2001:370:a115::3
option_ip4prefixlen=
option_ip6prefix= 
option_ip6prefixlen= 
option_ealen=
option_psidlen= 
option_offset=
  

設定

# map.sh.new
cp /lib/netifd/proto/map.sh /lib/netifd/proto/map.sh.bak
wget --no-check-certificate -O /lib/netifd/proto/map.sh https://raw.githubusercontent.com/site-u2023/map-e/main/map.sh.new

# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan6 NET_IF6
network_get_ipaddr6 NET_ADDR6 "${NET_IF6}"
CE_CE=`echo $NET_ADDR6 | cut -d':' -f1,2,3,4`

# DHCP LAN
uci set dhcp.lan=dhcp
uci set dhcp.lan.dhcpv6='server'
uci set dhcp.lan.ra='relay'
uci set dhcp.lan.ndp='relay'
uci set dhcp.lan.force='1'

# WAN
uci set network.wan.auto='0'

# WAN6
uci set network.wan6.ip6prefix=${CE_CE}::/56
# uci set network.wan6.encaplimit='ignore'

# DHCP WAN6
uci set dhcp.wan6=dhcp
uci set dhcp.wan6.interface='wan6'
uci set dhcp.wan6.ignore='1'
uci set dhcp.wan6.master='1'
uci set dhcp.wan6.ra='relay'
uci set dhcp.wan6.dhcpv6='relay'
uci set dhcp.wan6.ndp='relay'

# WANMAP
WANMAP='wanmap'
uci set network.${WANMAP}=interface
uci set network.${WANMAP}.proto='map'
uci set network.${WANMAP}.maptype='map-e'
uci set network.${WANMAP}.peeraddr=${option_peeraddr}
uci set network.${WANMAP}.ipaddr=${option_ipaddr}
uci set network.${WANMAP}.ip4prefixlen=${option_ip4prefixlen}
uci set network.${WANMAP}.ip6prefix=${option_ip6prefix}
uci set network.${WANMAP}.ip6prefixlen=${option_ip6prefixlen}
uci set network.${WANMAP}.ealen=${option_ealen}
uci set network.${WANMAP}.psidlen=${option_psidlen}
uci set network.${WANMAP}.offset=${option_offset}
uci set network.${WANMAP}.legacymap='1'
uci set network.${WANMAP}.mtu='1460'
uci set network.${WANMAP}.encaplimit='ignore'
uci set network.${WANMAP}.tunlink='wan6'

# FW
ZOON_NO='1'
uci del_list firewall.@zone[${ZOON_NO}].network='wan'
uci add_list firewall.@zone[${ZOON_NO}].network=${WANMAP}

uci commit

# map
sed -i -e "s/ip4prefixlen=32/ip4prefixlen=${option_ip4prefixlen}/g" /lib/netifd/proto/map.sh

reboot

疎通確認

ポート動作確認

リムーブ

レストア

  • map.sh
- map.sh
- map-e.html
cp /lib/netifd/proto/map.sh.bak /lib/netifd/proto/map.sh
rm /lib/netifd/proto/map.sh.bak

# map-e.html
rm /www/map-e.html

IPv6

チューニング及びベンチマーク

あとがき

  • バーチャルコネクト未設定状態でもopkgのDLは可能

参考サイト(感謝:relaxed:)

3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?