こちらに統合しました
BASH版
- 軽量なbash版に移行しました
※ 375kB + α
はじめに
PowerShellでSSHアクセス
-
PowerShellの開始 (キー入力):
Win
+x
>a
>はい
※Windows7以降標準搭載
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ログイン出来ない場合
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
対応回線
自動設定 : 回線直結全自動構成
- 対応回線業者:JPIX
-
V6プラス ※ Wikipedia参照
- Tigers-net.com (アイテック阪急阪神)
- MAGMA光 (インターネットMAGMA)
- @ nifty (ニフティ)
- GMOとくとくBB (GMOとくとくBB)
- 21Company (21Company)
- アピオン (アピオン)
- HAL (ウイル)
- 晴れの国ネット (シックス)
- JANIS (長野県協同電算)
- KISNET (創風システム)
- Gaming+ (ゲーミングプラス) (ネットフォレスト)
- DMM光 (DMM.com)
- So-net (So-net)
- オープンサーキット (オープンサーキット)
- タムネット (tam.ne.jp)
- IPv6オプション(BIGLOBE)
-
V6プラス ※ Wikipedia参照
- 対応機器 : 光回線終端装置 (ONU) ※ ホームゲートウェイ (HGW) 非対応
- 対応認証 : IPoE接続 ※ PPPoE接続非対応
- 対応ファームウェア : 22.03 以降 ※FW4 (firewall4)
- 構成状態 : ネットワークインターフェース初期値前提
- スクリプト :config-softwire (JavaScript) / all-ports-set
- パッケージ : map / node @ JavaScriptをデバイスで動かす
- 必要フラッシュ容量 : 12 MiB 以上 @ node
- 動作確認 : 5chの民
- 設定詳細 : 参考サイト
- WRX-5959AX12での設定事例
- バージョン 21.02以降?
全自動構成 ※ 要ONU直結
インストール
# package
opkg update
opkg install map
opkg install node
reboot
全自動構成
# config-softwire
wget --no-check-certificate -O /lib/netifd/proto/map-e.js https://raw.githubusercontent.com/site-u2023/config-softwire/main/map-e.js
# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan6 NET_IF6
network_get_ipaddr6 NET_ADDR6 "${NET_IF6}"
NODE_RET=$(node /lib/netifd/proto/map-e.js "$NET_ADDR6")
eval "$NODE_RET"
# 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'
# 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'
# WAN6
uci set network.wan6.ip6prefix=${CE}::/56
# uci set network.wan6.encaplimit='ignore'
# WAN
uci set network.wan.auto='0'
# 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
reboot
疎通確認
-
V6プラス
-
他
ニチバン対策 ※ 要ONU直結
map使わない版
# all-ports-set
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
# scripts
. /lib/functions/network.sh
network_flush_cache
network_find_wan NET_IF
network_find_wan6 NET_IF6
network_get_ipaddr6 NET_ADDR6 "${NET_IF6}"
network_get_device NET_L3D "${NET_IF}"
NODE_RET=$(node /lib/netifd/proto/map-e.js "$NET_ADDR6")
eval "$NODE_RET"
sed -i -e "s/IPv4_IPv4/IPv4=${IPv4}/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
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
ポート動作確認
リムーブ
リムーブ
- node
- map-e.js
# node
opkg remove node
# map-e.js
rm /lib/netifd/proto/map-e.js
レストア
- mape_setup_rule.sh
- map.sh
# mape_setup_rule.sh
sed -i -e "s/^.*mape_setup_rule.sh//g" /etc/rc.local
rm /etc/mape_setup_rule.sh
# map.sh
cp /lib/netifd/proto/map.sh.bak /lib/netifd/proto/map.sh
rm /lib/netifd/proto/map.sh.bak
トラブルシュート
# prefix確認
echo ${PREFIX}
# node確認
ls /usr/lib/opkg/info/node*
IPv6
チューニング及びベンチマーク
あとがき
- バーチャルコネクト未設定状態でもopkgのDLは可能