EliasKotlyar / Xiaomi-Dafang-Hacks

4.19k stars 1k forks source link

How can I set the gateway? #1878

Closed t316161070 closed 1 year ago

t316161070 commented 1 year ago

I changed the static.conf.dist file to static.conf and modified the IP address inside. This way, the static IP effect can be achieved, but there is no gateway at this time, which makes it impossible for cameras to connect to the internet to obtain time. How can I set the gateway?

MrToast72 commented 7 months ago

I managed to do this but I'm just away from my computer, I'll update my comment with the instructions when I can!

MrToast72 commented 7 months ago

If you already have the camera deployed, then the only way would be to ssh in and edit some configs ill drop below, otherwise you can edit these directly on the sdcard under the /config folder.

First edit defaultgw.conf.dist :

# default gateway IP address
10.0.xx.xx

and save it as defaultgw.conf

Next, edit wpa_suplicant.conf and make sure all the settings are set correctly for wpa2 connection :

network={
ssid="REDACTED"
        # Uncomment to connect to Hidden SSIDs
        # scan_ssid=1
        key_mgmt=WPA-PSK
        pairwise=CCMP TKIP
        group=CCMP TKIP WEP104 WEP40
        psk="REDACTED"
        priority=2
        #wps_cred_add_sae=1
        proto=WPA2
}

Lastly, edit resolv.conf.dist making sure to save it as resolv.conf :

## An example resolv.conf to use with static IP configuration
## This file is only relevant when a static address is configured
## Otherwise, resolv.conf is managed by DHCP
## Uncomment lines as needed, everything is optional

## Detailed documentation:
## https://linux.die.net/man/5/resolv.conf

## List DNS server addresses, primary, secondary, etc
nameserver 10.0.xx.xx  <--- Uncomment me and change to your routers IP
#nameserver 192.168.1.2
#nameserver 1.1.1.1
#nameserver 8.8.8.8

## Domain of this system
## Determined automatically from fully-qualified hostname when unspecified
#domain myteam.myorg.mycorp.net

## Search list to resolves unqualified hostnames
## Defaults to domain when unspecified
#search myteam.myorg.mycorp.net myorg.mycorp.net mycorp.net

Then if your camera is running, give it a reboot and it should pickup your network and populate the Gateway and DNS in the UI.