Openwrt lan 設定 dhcp 給予的虛假 ip 位址

Openwrt lan 設定 dhcp 給予的虛假 ip 位址

當我將網路配置為使用 IP 位址時,其他192.168.1.1連接裝置會被賦予一個虛假的 IP 位址,例如169.254.5.54.我是否缺少某個配置設置,使我能夠將 LAN 介面設置為192.168.10.1並獲取 DHCP 位址192.168.10.*?正在使用 Chaos Calmer 15.05。

這是我的設定: /etc/config/network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fd70:bf5f:ddc6::/48'

config interface 'lan'
    option ifname 'eth1'
    option force_link '1'
    option type 'bridge'
    option proto 'static'
    option netmask '255.255.255.0'
    option ip6assign '60'
    option gateway '109.193.64.50'
    option dns '127.0.0.1 8.8.8.8'
    option ipaddr '192.168.1.1'

config interface 'wan'
    option ifname 'eth0'
    option proto 'dhcp'

config interface 'wan6'
    option ifname '@wan'
    option proto 'dhcpv6'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '0 2 3 4 5'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '1 6'

/etc/config/dhcp

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'lan'
    option expandhosts '1'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'
    option strictorder '1'
    list server '8.8.8.8'

config dhcp 'lan'
    option interface 'lan'
    option start '100'
    option limit '150'
    option leasetime '12h'
    option dhcpv6 'server'
    option ra 'server'
    option ra_management '1'

config dhcp 'wan'
    option interface 'wan'
    option ignore '1'

config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'

config domain

答案1

@DavidPostill 為我指明了正確的方向。我更改了以下內容以使 dhcp 與 eth0 lan 介面 IP 位址一起工作192.168.10.1。您無法在 LuCI 網站配置中完成所有這些更改,因此您必須 ssh 進入路由器並進行更改。

/etc/config/network:

config interface 'lan'
    option ipaddr '192.168.10.1'

/etc/dnsmasq.conf:

listen-address=127.0.0.1,192.168.10.1

/etc/init.d/dnsmasq第 409 行註解掉:

# append_bool "$cfg" ignore "--no-dhcp-interface=$ifname" && return 0

刪除 中已儲存的 dhcp 位址/tmp/dhcp.leases。重新啟動。

如果這不起作用,只需手動為您的電腦指派靜態 IP 位址,重新登入路由器,然後查看下產生的 dhcp 設定/var/etc/dnsmasq.conf。進行更改並使用 重新啟動 dnsmasq /etc/init.d/dnsmasq restart

相關內容