roys / java-hdl-webserver

Using Google Home to control HDL Buspro smart home
MIT License
11 stars 1 forks source link

Setting the gateway address #1

Closed alydersen closed 1 year ago

alydersen commented 7 years ago

Hello Roy,

I have the gateway on a separate ip-range than the dhcp-range (for security reasons). So my Raspberry Pi has two addresses configured. I've installed and started your server, but it can't find anything. So I'm thinking it is because it searches on the wrong network. Is there any way to set the gateway address?

BTW: The plan is to have your webserver configured with home-assistant to combine it with the rest of my smart devices.

Thanks, Andreas

roys commented 7 years ago

Hey @alydersen!

Seems like I don't get e-mail notifications on new issues. :/

Interesting setup you got! I'm glad to hear that there are others out there caring for security. :) I'm sure you're right in your assumption that it is searching on the wrong network.

Do you have two different networks with two network physical components on your Pi? Or is some kind of network configuration to split the networks?

I'm sure it should be relatively easy to fix this. :)

alydersen commented 7 years ago

Hi @roys!

So, the extra IP is just added on a virtual interface eth0:0. In respect to security, it doesn't offer much, but at least a simple port scan on the DHCP-assigned subnet wouldn't find anything.

Andreas

roys commented 7 years ago

@alydersen

Would you mind pasting the network config so that I can set it up the same and check that it works?

alydersen commented 7 years ago

@roys:

/etc/dhcpcd.conf:

hostname
clientid
persistent
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

nohook lookup-hostname

interface eth0
static ip_address=10.0.0.2/24
static routers=10.0.0.1
static domain_name_servers=10.0.0.1

interface eth0:0
static ip_address=192.168.10.10/24

and ifconfig command returns:

eth0      Link encap:Ethernet  HWaddr b8:27:eb:b3:1d:e0  
          inet addr:10.0.0.2  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::d66f:4a36:d9e6:f8e6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:37987743 errors:0 dropped:4401 overruns:0 frame:0
          TX packets:29802047 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4009650487 (3.7 GiB)  TX bytes:2644861166 (2.4 GiB)

eth0:0    Link encap:Ethernet  HWaddr b8:27:eb:b3:1d:e0  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:776478 errors:0 dropped:0 overruns:0 frame:0
          TX packets:776478 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:103471041 (98.6 MiB)  TX bytes:103471041 (98.6 MiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:e6:48:b5  
          inet6 addr: fe80::4562:130e:4b55:5088/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:2 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:123 (123.0 B)  TX bytes:0 (0.0 B)