Hi,
I'm running OpenWRT 21.02.0 on a NETGEAR R7800 and, due to me being stupid while trying to backup the file, I accidentally deleted /etc/config/network
. As you might have guessed, I have no backup of said file but I can still SSH into the router (however, the router is not physically located near me). Note that I do have a full OpenWRT backup, downloaded from LuCI, after I realized what happend.
I was able to run ubus list network.interface.*
and ifstatus <all interfaces>
as I thought they might help restoring /etc/config/network
. Here is their output, respectively.
ubus list network.interface.*
network.interface.lan
network.interface.loopback
network.interface.wan
network.interface.wan6
network.interface.wgnet
ifstatus <all interfaces>
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 60546,
"l3_device": "br-lan",
"proto": "static",
"device": "br-lan",
"updated": [
"addresses",
"routes"
],
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.0.1",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
{
"address": "fdc8:1a50:cfb1::",
"mask": 60,
"local-address": {
"address": "fdc8:1a50:cfb1::1",
"mask": 60
}
}
],
"route": [
{
"target": "0.0.0.0",
"mask": 0,
"nexthop": "192.168.0.254",
"source": "0.0.0.0/0"
}
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
}
}
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 60552,
"l3_device": "lo",
"proto": "static",
"device": "lo",
"updated": [
"addresses"
],
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "127.0.0.1",
"mask": 8
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
}
}
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 60562,
"l3_device": "eth0.2",
"proto": "dhcp",
"device": "eth0.2",
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.1.206",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "0.0.0.0",
"mask": 0,
"nexthop": "192.168.1.254",
"source": "192.168.1.206/32"
}
],
"dns-server": [
"192.168.1.254"
],
"dns-search": [
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
"leasetime": 86400
}
}
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 60550,
"l3_device": "eth0.2",
"proto": "dhcpv6",
"device": "eth0.2",
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
],
"ipv6-address": [
{
"address": "2001:b07:5d29:e1e9:7ad2:94ff:fe52:27ff",
"mask": 64
}
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "2001:b07:5d29:e1e9::",
"mask": 64,
"nexthop": "::",
"metric": 256,
"source": "::/0"
},
{
"target": "::",
"mask": 0,
"nexthop": "fe80::7a29:edff:fe32:2593",
"metric": 640,
"valid": 1397,
"source": "2001:b07:5d29:e1e9:7ad2:94ff:fe52:27ff/64"
}
],
"dns-server": [
"2001:b07:5d29:e1e9:7a29:edff:fe32:2593"
],
"dns-search": [
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
"passthru": "0017001020010b075d29e1e97a29edfffe322593"
}
}
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 53574,
"l3_device": "wgnet",
"proto": "wireguard",
"updated": [
"addresses",
"routes"
],
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "10.0.0.1",
"mask": 24
}
],
"ipv6-address": [
],
"ipv6-prefix": [
],
"ipv6-prefix-assignment": [
],
"route": [
{
"target": "10.0.0.2",
"mask": 32,
"nexthop": "0.0.0.0",
"source": "0.0.0.0/0"
},
{
"target": "10.0.0.3",
"mask": 32,
"nexthop": "0.0.0.0",
"source": "0.0.0.0/0"
},
{
"target": "10.0.0.4",
"mask": 32,
"nexthop": "0.0.0.0",
"source": "0.0.0.0/0"
}
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
],
"inactive": {
"ipv4-address": [
],
"ipv6-address": [
],
"route": [
],
"dns-server": [
],
"dns-search": [
],
"neighbors": [
]
},
"data": {
}
}
Before doing any further damage, could you please assist me in restoring said file? Thanks a lot!
Here is what I've came up with:
/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 interface 'lan'
option device 'br-lan'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.0.1'
option netmask '255.255.255.0'
config interface 'wan'
option device 'eth0.2'
option proto 'dhcp'
config interface 'wan6'
option device 'eth0.2'
option proto 'dhcpv6'