Difference between revisions of "Openwrt"
From Steak Wiki
Jump to navigationJump to search (Created page with "Various tips: ===reserved ip / static lease==== {{cat|/etc/config/dhcp|config host option ip 192.168.1.122 option mac c2:44:32:18:cd:ab option name re...") |
|||
Line 1: | Line 1: | ||
− | + | ==Tips== | |
− | ===reserved ip / static lease | + | ===port forwarding=== |
+ | Port forwarding is two steps: | ||
+ | # redirect port from outside to internal | ||
+ | # allow access from outside to inside via this port | ||
+ | |||
+ | {{cat|/etc/config/firewall| | ||
+ | config redirect | ||
+ | option name 'PassthroughformyServer' | ||
+ | option src 'wan' | ||
+ | option proto 'tcp' | ||
+ | option src_dport '80' | ||
+ | option dest_ip '192.168.1.100' | ||
+ | option dest_port '80' | ||
+ | option target 'DNAT' | ||
+ | option dest 'lan' | ||
+ | |||
+ | |||
+ | config rule | ||
+ | option src 'wan' | ||
+ | option proto 'tcp' | ||
+ | option dest_port '80' | ||
+ | option target 'ACCEPT' | ||
+ | |||
+ | }} | ||
+ | Note: Proto can be 'tcp' OR 'tcpudp' OR 'udp' | ||
+ | |||
+ | ===reserved ip / static lease=== | ||
{{cat|/etc/config/dhcp|config host | {{cat|/etc/config/dhcp|config host | ||
option ip 192.168.1.122 | option ip 192.168.1.122 |
Revision as of 16:08, 22 June 2020
Tips
port forwarding
Port forwarding is two steps:
- redirect port from outside to internal
- allow access from outside to inside via this port
Contents of /etc/config/firewall
config redirect
option name 'PassthroughformyServer'
option src 'wan'
option proto 'tcp'
option src_dport '80'
option dest_ip '192.168.1.100'
option dest_port '80'
option target 'DNAT'
option dest 'lan'
config rule
option src 'wan'
option proto 'tcp'
option dest_port '80'
option target 'ACCEPT'
Note: Proto can be 'tcp' OR 'tcpudp' OR 'udp'
reserved ip / static lease
Contents of /etc/config/dhcp
config host
option ip 192.168.1.122
option mac c2:44:32:18:cd:ab
option name reservedipcomputer
ref: https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#static_leases