cognac是什么酒| 宝宝拉肚子有粘液是什么原因| cini是什么意思| 肾主什么| 卢字五行属什么| 间接胆红素偏高是什么意思| 抬旗是什么意思| 刘备儿子叫什么| 89年属什么生肖| 皮肤溃烂是什么病| 刘玄德属什么生肖| mfd是什么意思| 什么是基础医学| 岁寒三友是指什么| 吃什么能安神助睡眠| 脑白质病变吃什么药| 为什么睡觉会磨牙| 夸父为什么要追赶太阳| 善存什么时间吃比较好| 如获至宝是什么意思| 乳房疼痛吃什么消炎药| 诞生是什么意思| 手术后不能吃什么食物| uw是什么单位| cp什么意思| 妈宝女是什么意思| 喝老陈皮水有什么好处| 狐臭用什么药| 马天尼是什么酒| 西梅是什么水果| 白细胞偏低是什么原因| 舌头短是什么原因| 坚果什么时候吃最好| 八面玲珑代表什么生肖| 什么的香味| 寿司用什么米做好吃| 失不出头念什么| 2022年五行属什么| hbcab偏高是什么意思| 做梦买房子是什么预兆| 天才是什么意思| 肺气阴两虚吃什么中成药| 生理反应是什么意思| 小人痣代表什么意思| 猝死是什么原因造成的| 玫瑰的花语是什么| 公安局大队长是什么级别| 肾结石有什么症状哪里疼| 高定是什么意思| hbcab偏高是什么意思| 鼻中隔偏曲是什么意思| 生育证是什么| 摆渡人是什么意思| 宫颈肥大有什么危害| 凹陷性疤痕用什么药膏| 安抚奶嘴什么时候戒掉| 北方的木瓜叫什么| 喝什么解辣| 火腿炒什么菜好吃| 坐骨神经痛什么症状| 什么充电宝可以带上飞机| 孩子拉肚子吃什么药| 什么是神经| 什么地流着| 吃什么能快速减肥| 心电图窦性心律是什么意思| elsa是什么意思| a型血rh阳性是什么意思| 什么人不能吃海参| 右肺中叶索条什么意思| 经常长溃疡是什么原因引起的| 乔其纱是什么面料| 朱元璋是什么民族| 甜菜碱是什么东西| 副司长是什么级别| 泡脚出汗有什么好处| 为什么会牙痛| 什么情况需要打破伤风针| s和m是什么| 四六风是什么病| 什么人不能吃黄精| 左室舒张功能减低吃什么药| 涂防晒霜之前要涂什么| 是什么部首| 风寒感冒流鼻涕吃什么药| 帝旺是什么意思| 腿浮肿是什么原因引起的| 东莞有什么好玩的地方| 后羿是一个什么样的人| 无药可救是什么意思| 什么情况| 胃热吃什么药最有效| 为什么人| 天干地支是什么意思| 吹面不寒杨柳风什么意思| 子宫肌瘤吃什么食物好| 视力5.3是什么概念| 女人鼻子大代表什么| 孩子半夜咳嗽是什么原因| 墓库是什么意思| 爵迹小说为什么不写了| 凝字五行属什么| 小孩睡觉出很多汗是什么原因| 床上为什么会有跳蚤| 吃什么补黑色素最快| 保妇康栓是治疗什么的| 阑尾炎不能吃什么| 莫逆之交什么意思| 脑出血什么原因引起的| 用盐水洗脸有什么好处和坏处| 吃什么水果减肥最快减肚子| em是什么意思| 2035年属什么生肖| 刺青是什么意思| 少将是什么级别| 左侧后背疼是什么原因男性| 知识渊博是什么意思| 8个月宝宝吃什么辅食好| remax是什么牌子| 邓绥和阴丽华什么关系| 小孩肠系膜淋巴结炎吃什么药| 中指戴戒指代表什么| 什么汤补气血效果最好| 天理是什么意思| 喜欢咬指甲是什么原因| 三头六臂是什么意思| 梦到分手了是什么征兆| 规培护士是什么意思| 黄牛什么意思| 谷草谷丙比值偏高代表什么| 什么是裙带菜| 老妹是什么意思| 元宵节吃什么| 奇亚籽在中国叫什么| 酒后吃什么水果好| 南瓜长什么样子的图片| 得瑟什么意思| 鎏是什么意思| 西安有什么美食| 白敬亭父母是干什么的| 血清铁蛋白是检查什么| 胆囊炎的症状是什么| 什么是海藻糖| 钾低了会出现什么症状| 人武部是干什么的| 蓟类植物是什么| 欢五行属什么| csw是什么意思| 尼古丁是什么东西| h是什么牌子的皮带| 4月25号什么星座| allin什么意思| 牙齿黄是什么原因造成的| 什么是腹泻| 家里什么东西止血最快| 花团锦簇什么意思| 胶原蛋白起什么作用| 不知道叫什么名字好| 卒中优先是什么意思| 什么的雨丝| 飞机杯是什么东西| 吃什么水果对心脏有好处| 成人用品是什么| 人类的祖先是什么| 苹果花是什么颜色| 什么是hpv感染| 什么的草坪| 水生木是什么意思| 属狗男和什么属相最配| 眼疲劳用什么眼药水| 拉绿色的屎是什么原因| 奎宁现在叫什么药| 眼角痒用什么药| 嗓子吞咽疼痛吃什么药| 大器晚成是什么意思| 咽颊炎吃什么药| 什么叫全日制本科| 睾丸萎缩是什么原因| 三围是什么| 肺有问题会出现什么症状| fredperry是什么牌子| 早上起来眼睛肿是什么原因| 高血压要吃什么| 甲状腺结节是什么症状| 河北有什么市| 胰尾显示不清什么意思| 上午十点是什么时辰| 篱笆是什么东西| 荷叶像什么比喻句| 地盆是一种什么病| 黑枸杞对男性性功能有什么帮助| 感冒吃什么消炎药| 肉五行属什么| 口腔溃疡为什么是白色的| 人间烟火是什么意思| 放我一个人生活是什么歌| 什么运动可以瘦脸| 鼻子上长红疙瘩是什么原因| 面瘫挂什么科| 舒张压偏低是什么原因| 8月初是什么星座| 常务副省长是什么级别| 眼睛疲劳用什么眼药水| 入殓师是什么意思| 阿莫西林治什么| 梦见捡手机是什么意思| 皮的偏旁是什么| 没什么大不了| 前列腺增生吃什么药最好| 破关是什么意思| 吃什么下奶快| 梦见玉米是什么意思| 咪咪头疼是什么原因| 下眼睑浮肿是什么原因| 增致牛仔属于什么档次| 什么什么满门| 全身皮肤瘙痒是什么原因引起的| 鼻子出血什么原因| 大乌龙是什么意思| 五月天主唱叫什么名字| 点卯是什么意思| 懦弱的近义词是什么| 喝茶为什么睡不着觉| 来姨妈为什么是黑色的血| 5月23号是什么星座| 蝉鸣声耳鸣是什么原因引起的| 美国为什么不建高铁| 梦见蛇缠身是什么意思| 双肺纹理增多是什么意思| 冻顶乌龙茶属于什么茶| 花重锦官城的重是什么意思| 甲沟炎涂什么药膏| 乳清粉是什么东西| 口食读什么| 黄金变黑是什么原因| 吃什么帮助消化通便| 升学宴选什么日子好| 尿蛋白质阳性是什么意思| 吃什么可以让胸部变大| 肾挂什么科室| 孕妇胃疼可以吃什么药| 辐射对人体有什么伤害| top1是什么意思| 毕业证有什么用| 痛经什么原因引起的| 2003年是什么年| 男人吃荔枝有什么好处| ppl是什么药| 鲜字五行属什么| 25分贝相当于什么声音| 九月是什么星座| 妈宝女是什么意思| 报晓是什么意思| 净身出户什么意思| 7月1日是什么节| 色盲色弱是什么意思| 例假血是黑色的是什么原因| 牙龈经常发炎是什么原因| 月经什么时候来| 什么时候不能喷芸苔素| 左心房增大是什么原因| 骨龄是什么意思| 小叶增生吃什么药好| 什么东西不能吃| 百度

倩女幽魂手游3月16日加开互通新服【草长莺飞】

百度 迪丽热巴·牙合甫说:“光脚是为了让行走一天的双脚在沙粒里按摩一下,这个弹药箱足有15公斤,几乎每天都会进行这样的深蹲训练”(7月14日摄)。

OpenWrt?is a powerful router operating system, and it can also be used for other purposes. Currently, it is most widely used as a router.

The core function of a router is, of course, networking. Familiarity with?OpenWrt?network configuration is essential for both developers and enthusiasts. I believe OpenWrt is the best system to learn Linux networking, as it not only allows you to learn basic network configuration but also lets you study the Linux protocol stack in conjunction with the Linux kernel. Here, I will introduce the basic configuration of OpenWrt networking.

This article mainly explains through the command line, as many people install OpenWrt on an x86 virtual machine and often feel lost when the network is not working during the initial configuration. By knowing how to configure OpenWrt using the command line, you can configure OpenWrt networking without needing the web interface, which greatly facilitates enthusiasts tinkering with x86 or virtual machines.

Configuration Files

All OpenWrt configurations are stored in the /etc/config directory. The following are the main network configuration files:

  • Network interface configuration?/etc/config/network
  • Network service configuration?/etc/config/dhcp
  • Firewall configuration?/etc/config/firewall

Network Interfaces

OpenWrt network interfaces generally include LAN and WAN ports. However, if it is an x86 device with only one network card, it will only generate LAN port information. In a virtual machine, we typically configure only one network card by default to facilitate network configuration. After familiarizing yourself with the basic network configurations, you can try turning OpenWrt into a router.

Viewing Network Card Configuration and IP Information

In previous tutorials, we set the network card IP to dynamically obtain an IP address. So, what are the ways to view the network card and IP information?

  • View through the web interface?This is our most commonly used viewing method. However, as a developer, you should learn the following command line methods to view it.
  • ifconfig

ifconfig is a command used to display and configure network interfaces in Linux/Unix operating systems.

The ifconfig command can display information about all available network interfaces in the current system, such as IP address, MAC address, subnet mask, broadcast address, etc.

Command format:?ifconfig $ifname.

For example, to view LAN port information:?ifconfig br-lan

br-lan    Link encap:Ethernet  HWaddr 00:0C:29:9F:9A:35
          inet addr:192.168.10.161  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fdf1:f344:c0d9::1/60 Scope:Global
          inet6 addr: fe80::20c:29ff:fe9f:9a35/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:71256 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50883 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19697329 (18.7 MiB)  TX bytes:48109633 (45.8 MiB)

To view all interfaces: ifconfig

Since ifconfig only shows IP and subnet mask information, you also need to use the ip or route command to view routing information.

root@OpenWrt:~# ip route
default via 192.168.10.1 dev br-lan  src 192.168.10.161 
192.168.10.0/24 dev br-lan scope link  src 192.168.10.161 
root@OpenWrt:~# 
root@OpenWrt:~# 
root@OpenWrt:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.10.1    0.0.0.0         UG    0      0        0 br-lan
192.168.10.0    *               255.255.255.0   U     0      0        0 br-lan
root@OpenWrt:~# 

View through ubus command

ubus is a lightweight RPC (Remote Procedure Call) mechanism in OpenWrt used for inter-process communication. ubus supports JSON-based messaging and asynchronous communication, and can be used to perform various operations on OpenWrt devices, such as obtaining device status, configuring network settings, querying system information, etc.

You can use the ubus command to view network information of OpenWrt devices.

The specific steps are as follows:

Get detailed information about a specific network interface (interface name, MAC address, IP address, subnet mask, broadcast address, gateway, DNS server)

ubus call network.interface.<interface_name> status

Where <interface_name> is the name of the network interface. For example, to get detailed information about the LAN interface: ubus call network.interface.lan status

{
 "up": true,
 "pending": false,
 "available": true,
 "autostart": true,
 "dynamic": false,
 "uptime": 14506,
 "l3_device": "br-lan",
 "proto": "dhcp",
 "device": "br-lan",
 "metric": 0,
 "dns_metric": 0,
 "delegation": true,
 "ipv4-address": [
  {
   "address": "192.168.10.161",
   "mask": 24
  }
 ],
 "ipv6-address": [
  
 ],
 "ipv6-prefix": [
  
 ],
 "ipv6-prefix-assignment": [
  {
   "address": "fdf1:f344:c0d9::",
   "mask": 60,
   "local-address": {
    "address": "fdf1:f344:c0d9::1",
    "mask": 60
   }
  }
 ],
 "route": [
  {
   "target": "0.0.0.0",
   "mask": 0,
   "nexthop": "192.168.10.1",
   "source": "192.168.10.161/32"
  }
 ],
 "dns-server": [
  "192.168.10.1"
 ],
 "dns-search": [
  
 ],
 "neighbors": [
  
 ],
 "inactive": {
  "ipv4-address": [
   
  ],
  "ipv6-address": [
   
  ],
  "route": [
   
  ],
  "dns-server": [
   
  ],
  "dns-search": [
   
  ],
  "neighbors": [
   
  ]
 },
 "data": {
  "dhcpserver": "192.168.10.1",
  "hostname": "OpenWrt",
  "leasetime": 1800
 }
}

View configuration?

We can also obtain network card configuration information by reading the configuration, but if it is set to DHCP mode, the status data will not be stored in the configuration. This method is suitable for viewing basic information, such as IP address acquisition method, interface information, etc.?View file command?cat /etc/config/network

root@OpenWrt:~# cat /etc/config/network 

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

config globals 'globals'
 option ula_prefix 'fdf1:f344:c0d9::/48'

config device
 option name 'br-lan'
 option type 'bridge'
 list ports 'eth0'

config interface 'lan'
 option device 'br-lan'
 option ipaddr '192.168.1.1'
 option netmask '255.255.255.0'
 option ip6assign '60'
 option proto 'dhcp'

uci configuration viewing command uci show network

root@OpenWrt:~# uci show network
network.loopback=interface
network.loopback.device='lo'
network.loopback.proto='static'
network.loopback.ipaddr='127.0.0.1'
network.loopback.netmask='255.0.0.0'
network.globals=globals
network.globals.ula_prefix='fdf1:f344:c0d9::/48'
network.@device[0]=device
network.@device[0].name='br-lan'
network.@device[0].type='bridge'
network.@device[0].ports='eth0'
network.lan=interface
network.lan.device='br-lan'
network.lan.ipaddr='192.168.1.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.lan.proto='dhcp'

uci show network.lan

root@OpenWrt:~# uci show network.lan
network.lan=interface
network.lan.device='br-lan'
network.lan.ipaddr='192.168.1.1'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.lan.proto='dhcp'

Network Configuration Commands

  • Configure dynamic acquisition?uci set network.lan.proto=dhcp
  • Configure static IP

Set IP configuration method:

uci set network.lan.proto='static' 

Set the IP address of the LAN port:

uci set network.lan.ipaddr='192.168.10.100'  

Set the subnet mask of the LAN port:

uci set network.lan.netmask='255.255.255.0'  

Set the gateway address of the LAN port:

uci set network.lan.gateway='192.168.10.1'  

Set the DNS server address:

uci set network.lan.dns='8.8.8.8'

If there are multiple DNS servers, you can separate multiple IP addresses with spaces, for example:

uci set network.lan.dns='8.8.8.8 8.8.4.4' 

Save the modified configuration:

uci commit network  

Finally, restart the network service to take effect

/etc/init.d/network reload

After completing the above steps, the LAN port of the OpenWrt device will be configured with a static IP address of 192.168.10.100, subnet mask of 255.255.255.0, gateway of 192.168.10.1, and DNS of 8.8.8.8.

Complete command:

uci set network.lan.proto='static'  
uci set network.lan.ipaddr='192.168.10.100'  
uci set network.lan.netmask='255.255.255.0'  
uci set network.lan.gateway='192.168.10.1'  
uci set network.lan.dns='8.8.8.8'  
uci commit network  
/etc/init.d/network reload  

After executing, you can view uci and configuration files

root@OpenWrt:~# uci set network.lan.proto='static'
root@OpenWrt:~# uci set network.lan.ipaddr='192.168.10.100'
root@OpenWrt:~# uci set network.lan.netmask='255.255.255.0'
root@OpenWrt:~# uci set network.lan.gateway='192.168.10.1'
root@OpenWrt:~# uci set network.lan.dns='8.8.8.8'
root@OpenWrt:~# uci commit network
root@OpenWrt:~# 
root@OpenWrt:~# 
root@OpenWrt:~# uci show network.lan
network.lan=interface
network.lan.device='br-lan'
network.lan.netmask='255.255.255.0'
network.lan.ip6assign='60'
network.lan.proto='static'
network.lan.ipaddr='192.168.10.100'
network.lan.gateway='192.168.10.1'
network.lan.dns='8.8.8.8'

LAN interface modified configuration

config interface 'lan'
 option device 'br-lan'
 option netmask '255.255.255.0'
 option ip6assign '60'
 option proto 'static'
 option ipaddr '192.168.10.100'
 option gateway '192.168.10.1'
 option dns '8.8.8.8'

Network Restart Commands

After modifying the network configuration, there are various ways to make the configuration effective:

# /etc/init.d/network reload

# /etc/init.d/network restart

# ubus call network reload

DHCP Server Configuration

The DHCP server is used to assign IP addresses to clients on the local area network. The DHCP server for the default LAN port is enabled. If the LAN virtual network card is set to bridge mode, the LAN port and PC are in the same broadcast domain, and the PC may obtain an IP assigned by the OpenWrt system.

To prevent multiple DHCP servers, we need to either change the LAN port to obtain an IP via DHCP or disable the DHCP server. Here, I will teach you how to disable the DHCP server.

  • The DHCP server configuration file is stored in /etc/config/dhcp, which contains the DHCP server configuration and interface DHCP configuration.
Comprehensive Guide to OpenWrt Network Configuration
  • Disable LAN port DHCP

Ignore LAN port DHCP:?uci set dhcp.lan.ignore=1?

Save configuration:?uci commit dhcp?

Restart service:?/etc/init.d/dnsmasq restart

WAN Port Configuration

If it is a router, the WAN interface is included by default. However, if it is a virtual machine with only one network card configured, it is necessary to configure the WAN interface to build a routing environment. For specific details, see the last tutorial on building OpenWrt virtual network environments.

View WAN port configuration

uci show network.wan

Common Configurations The WAN port configuration is similar to the LAN port. It can also be set to static, DHCP, PPPoE, etc. We can modify it using the uci command or edit the /etc/config/network configuration file using the vi command. The configuration activation method is the same as for the LAN port.

The following are various interface configurations in /etc/config/network:

  • DHCP mode
config interface 'wan'
        option device 'eth1'
        option proto 'dhcp'
  • Static IP
config interface 'wan'
 option device 'eth1'
 option proto 'static'
 option ipaddr '192.168.10.171'
 option netmask '255.255.255.0'
 list dns '192.168.10.1'
 list dns '8.8.8.8'
  • PPPoE Dial-up
config interface 'wan'
 option device 'eth1'
 option proto 'pppoe'
 option username 'test'
 option password '123456'
 option ipv6 'auto'

Building a Virtual Machine Routing Environment

  • Add a Virtual Network Card When we install the system through a virtual machine, only one network card is configured by default. Therefore, we need to add another network card for the WAN port.
Comprehensive Guide to OpenWrt Network Configuration

Network Planning

To facilitate the simulation of data forwarding from LAN to WAN, we need to add a virtual PC that is in the same local area network as the OpenWrt LAN port, while the OpenWrt WAN port is in the same local area network as the physical PC (either through bridging or NAT mode). This way, the virtual PC’s internet data will be processed by OpenWrt, which acts as a router.

Network Topology Configure the OpenWrt LAN interface as host mode bound to vmnet10 (others that are not occupied can also be used), so that all network cards in vmnet10 are in the same local area network as the OpenWrt LAN. The WAN port network card is set to bridge mode, so that the WAN port can obtain an IP assigned by the router and be in the same subnet as the PC network card.

The network topology diagram is as follows: Comprehensive Guide to OpenWrt Network Configuration

According to the network topology, you also need to add a client that binds its network card to vmnet10. This client can connect to the internet via the OpenWrt virtual machine. It is recommended to clone the OpenWrt system and then modify the network card configuration for use as a client. Of course, you can also add a Windows or Ubuntu virtual machine to connect to the OpenWrt router’s LAN port.

Managing OpenWrt After deploying according to the above topology, you may notice a problem: the physical PC cannot directly access OpenWrt, because the PC and the OpenWrt WAN port are in the same subnet, while the OpenWrt LAN is not in the same subnet. How can we manage and configure the OpenWrt system?

Here are two solutions:

  1. Add a virtual PC connected to the OpenWrt LAN port, so you can directly manage OpenWrt from the virtual PC.
  2. Access the OpenWrt system through the WAN port. Note that by default, you cannot directly access through the WAN port because OpenWrt has the WAN port firewall enabled by default, which needs to be disabled first.

Disable WAN Port Firewall Open the firewall configuration, find the configuration rules for the WAN port, change REJECT to ACCEPT, and then reload the firewall rules using vi /etc/config/firewall.

Comprehensive Guide to OpenWrt Network Configuration
/etc/init.d/firewall restart

After this, you will be able to access the OpenWrt system via the web interface using the WAN port IP. You can also access the backend by connecting to the WAN port IP via SSH. Note that for older versions of OpenWrt, you need to bind the SSH service to the WAN port to access it. The SSH configuration file is?/etc/config/dropbear, bind it to WAN and restart the service.

To restart the SSH service, use the command?

/etc/init.d/dropbear restart.

Leave a Comment

心脏彩超fs是什么意思 水厄痣是什么意思 占卜什么意思 乳腺3类是什么意思 湿热内蕴吃什么中成药
性价比高什么意思 根的作用是什么 1963年属什么生肖 脸上长痘痘去医院挂什么科 吃什么血脂降的最快
吃什么最补胶原蛋白 豆种翡翠属于什么档次 国际是什么意思 吃粽子是什么节日 搞基什么意思
新斯的明是什么药 盆腔积液用什么药 反复发烧吃什么药 万艾可是什么药 增加胃动力最好的药是什么药
左侧肋骨下面是什么器官hcv9jop1ns4r.cn 立牌坊是什么意思hkuteam.com 甲申日五行属什么hcv8jop0ns3r.cn 耳堵耳闷是什么原因hcv9jop3ns5r.cn 孩子不愿意吃饭是什么原因hcv7jop9ns1r.cn
6月份出生是什么星座fenrenren.com 成家是什么意思hcv8jop4ns0r.cn 拉泡沫稀便什么原因xscnpatent.com gu是什么品牌hcv9jop7ns1r.cn 冷暴力是什么意思wzqsfys.com
看望病人送什么东西hcv8jop6ns5r.cn 便秘吃什么好hcv9jop0ns7r.cn 枸杞和山楂泡水喝有什么功效hcv8jop2ns0r.cn 刷存在感是什么意思hcv9jop5ns2r.cn 什么是前置胎盘hcv8jop3ns7r.cn
肾结石少吃什么食物hcv7jop7ns3r.cn 农历六月初十是什么日子hcv8jop2ns5r.cn 做梦梦到别人死了是什么征兆hcv8jop9ns1r.cn 什么水果是发物hcv7jop9ns9r.cn 蛇屎是什么样子hcv7jop4ns6r.cn
百度