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.

OpenWrt 22.03 23.05 FW4 ニチバン対策 旧版

Last updated at Posted at 2023-07-27

移行しました

はじめに

初心者対応構成

  • スクリプトでの自動設定
  • 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


対応回線

全自動構成

  • 必要フラッシュ容量 : 12 MiB 以上 @ node

ニチバン対策

高度なカスタム構成 ※ 要ONU直結

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}"
# echo "${NET_ADDR6}"
sed -i -e "s/IPv6ADDRESS/${NET_ADDR6}/g" /www/map-e.html

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

設定値入力

  • 以下にconfig-softwareで確認したoption値を入力
# option値
option_ip4prefixlen=

設定

# map-e
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

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

reboot

レストア

  • map
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

MAP-E のポートセット全部使う ※ 要ONU直結

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}"
# echo "${NET_ADDR6}"
sed -i -e "s/IPv6ADDRESS/${NET_ADDR6}/g" /www/map-e.html

  • 以下を開く
    web-config-software
  • 計算をクリック ※ 値は入力済み
  • 以下の値を確認
    • PSID
    • option_ip4prefixlen
  • IPv6 プレフィックスかアドレスを入力:V6疎通確認の結果を入力
  • 以下にconfig-softwareで確認したPSID値とoption値を入力
# option値
PSID=
option_ip4prefixlen=

all-ports-set

map使う版
wget --no-check-certificate -O /etc/mape_setup_rule.sh https://raw.githubusercontent.com/site-u2023/all-ports-set/main/use_mape_setup_rule.sh
chmod +x /etc/mape_setup_rule.sh

map使わない版
wget --no-check-certificate -O /etc/mape_setup_rule.sh https://raw.githubusercontent.com/site-u2023/all-ports-set/main/dont_mape_setup_rule.sh
chmod +x /etc/mape_setup_rule.sh

OCNバーチャルコネクト設定

# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_find_wan6 NET_IF6
network_get_ipaddr NET_ADDR "${NET_IF}"
network_get_device NET_L3D "${NET_IF}"

sed -i -e "s/IPv4_IPv4/IPv4=${NET_ADDR}/g" /etc/mape_setup_rule.sh
sed -i -e "s/TUNDEV_TUNDEV/TUNDEV=${NET_L3D}/g" /etc/mape_setup_rule.sh
sed -i -e "s/PSID_PSID/PSID=${PSID}/g" /etc/mape_setup_rule.sh
sed -i -e "s/PREFIX_PREFIX/PREFIX=1024/g" /etc/mape_setup_rule.sh
sed -i -e "s/BLOCKS_BLOCKS/BLOCKS=63/g" /etc/mape_setup_rule.sh

cp /lib/netifd/proto/map.sh.bak /lib/netifd/proto/map.sh
sed -i -e "s/ip4prefixlen=32/ip4prefixlen=${option_ip4prefixlen}/g" /lib/netifd/proto/map.sh
sed -i -e "s/mtu:-1280/mtu:-1460/g" /lib/netifd/proto/map.sh

cp /etc/rc.local /etc/rc.local.bak
sed -i -e "s/exit 0//g" /etc/rc.local
echo "/etc/mape_setup_rule.sh" >> /etc/rc.local 
echo "exit 0" >> /etc/rc.local

reboot

V6プラス設定

# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_find_wan6 NET_IF6
network_get_ipaddr NET_ADDR "${NET_IF}"
network_get_device NET_L3D "${NET_IF}"

sed -i -e "s/IPv4_IPv4/IPv4=${NET_ADDR}/g" /etc/mape_setup_rule.sh
sed -i -e "s/TUNDEV_TUNDEV/TUNDEV=${NET_L3D}/g" /etc/mape_setup_rule.sh
sed -i -e "s/PSID_PSID/PSID=${PSID}/g" /etc/mape_setup_rule.sh
sed -i -e "s/PREFIX_PREFIX/PREFIX=4096/g" /etc/mape_setup_rule.sh
sed -i -e "s/BLOCKS_BLOCKS/BLOCKS=15/g" /etc/mape_setup_rule.sh

cp /lib/netifd/proto/map.sh.bak /lib/netifd/proto/map.sh
sed -i -e "s/ip4prefixlen=32/ip4prefixlen=${option_ip4prefixlen}/g" /lib/netifd/proto/map.sh
sed -i -e "s/mtu:-1280/mtu:-1460/g" /lib/netifd/proto/map.sh

cp /etc/rc.local /etc/rc.local.bak
sed -i -e "s/exit 0//g" /etc/rc.local
echo "/etc/mape_setup_rule.sh" >> /etc/rc.local 
echo "exit 0" >> /etc/rc.local

reboot

レストア

  • all-ports-set
  • map
# all-ports-set
sed -i -e "s/^.*mape_setup_rule.sh//g" /etc/rc.local
rm /etc/mape_setup_rule.sh

# map
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

確認

ポート動作確認

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

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?