mcarlin

mcarlin

I’m trying to set a fixed IP address for the USB VintageNetDirect type using VintageNet. Currently am trying to use the same syntax as a wired Ethernet (VintageNetEthernet), but this is failing. Below is a fragment from the target.exs.

config :vintage_net,
  regulatory_domain: "US",
  config: [
    {"usb0", 
     %{
       type: VintageNetDirect,
       ipv4: %{
        method: :static,
        address: "192.168.20.10",
        prefix_length: 24,
        gateway: "192.168.20.1",
        name_servers: ["8.8.4.4"]
       } 
      }
    },
    {"eth0",
     %{
       type: VintageNetEthernet,
       ipv4: %{method: :dhcp}
     }
    }
  ]

RingLogger shows that the configuration is failing, and usb0 is getting the internal default configuration inet 172.31.133.37 netmask 255.255.255.252. Does VintageNetDirect support fixed IP addresses?

Showing Posts 1 to 5

fhunleth

fhunleth

Co-author of Nerves

VintageNetDirect is specialized to the point-to-point use case with no routing or anything else. If you switch your "usb0" configuration to VintageNetEthernet, it looks like the configuration should work:

config :vintage_net,
  config: [
    {"usb0", 
     %{
       type: VintageNetEthernet,
       ipv4: %{
        method: :static,
        address: "192.168.20.10",
        prefix_length: 24,
        gateway: "192.168.20.1",
        name_servers: ["8.8.4.4"]
       } 
      }
    }
  ]
mcarlin

mcarlin OP

Thanks Frank,

This doesn’t work at compile time, but does work at runtime when I configure from the iex prompt. The IP address takes (I can ping and load web pages), but something is not as VintageNet.info returns errors after the VintageNetEthernet assignment. No big issue, I’m using this for testing multiple prototype units on the same network, we won’t be using usb networking in our production hardware. Below is a console grab if you are interested:

iex(2)> ifconfig
lo: flags=[:up, :loopback, :running]
inet 127.0.0.1 netmask 255.0.0.0
inet ::1 netmask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
hwaddr 00:00:00:00:00:00

sit0: flags=[]
hwaddr 00:00:00:00

usb0: flags=[:up, :broadcast, :running, :multicast]
inet 172.31.133.37 netmask 255.255.255.252 broadcast 172.31.133.37
hwaddr ca:08:56:00:13:be

iex(3)> VintageNet.configure("usb0", %{ type: VintageNetEthernet, ipv4: %{ method: :static, address: "192.168.20.10", prefix_length: 24, gateway: "192.168.20.1", name_servers: ["8.8.4.4"] } })
:ok
iex(4)> [ 73.596366] dwc2 49000000.usb-otg: dwc2_hsotg_ep_sethalt(ep 46007d83 ep1in, 0)
[ 73.603222] dwc2 49000000.usb-otg: dwc2_hsotg_ep_sethalt(ep 8db1c0f3 ep1out, 0)
[ 73.610577] dwc2 49000000.usb-otg: dwc2_hsotg_ep_sethalt(ep b82c4a2e ep2in, 0)

nil
iex(5)> ifconfig
lo: flags=[:up, :loopback, :running]
inet 127.0.0.1 netmask 255.0.0.0
inet ::1 netmask ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
hwaddr 00:00:00:00:00:00

sit0: flags=[]
hwaddr 00:00:00:00

usb0: flags=[:up, :broadcast, :running, :multicast]
inet 192.168.20.10 netmask 255.255.255.0 broadcast 192.168.20.10
hwaddr ca:08:56:00:13:be

iex(6)> VintageNet.info
VintageNet 0.7.6

** (ArgumentError) argument error
(stdlib 3.13) :ets.match(VintageNet, {["interface" | :"$1"], :"$2"})
(vintage_net 0.7.6) lib/vintage_net/property_table/table.ex:28: VintageNet.PropertyTable.Table.get_by_prefix/2
(vintage_net 0.7.6) lib/vintage_net.ex:83: VintageNet.all_interfaces/0
(vintage_net 0.7.6) lib/vintage_net/info.ex:22: VintageNet.Info.do_info/1

-Mark

fhunleth

fhunleth

Co-author of Nerves

Hi Mark,

This isn’t a configuring that I use, but I definitely want it to work as well - especially since it seems like it should.

We’ve made a few updates to VintageNet since 0.7.6. Is it possible for you to update? 0.7.9 should be a straightforward update. The latest is 0.9.0 which has breaking API changes, but they don’t affect many people. The updates include a few improvements to VintageNet.info to give more debugging information.

I don’t believe that any of the updates address whatever is causing compile-time configuration to not work. (I’m assuming that you don’t have a run-time configuration that is overriding it). In any case, could you file a bug with a few details on your device’s network connection so that we can track and fix this issue.

Thanks!!

mcarlin

mcarlin OP

Hi Frank,

Will be looking at this again early next week. Will be happy to file bug, on GitHub or somewhere else?

Thanks for the info!

fhunleth

fhunleth

Co-author of Nerves

Thanks!

Here’s the preferred place for filing an issue: Issues · nerves-networking/vintage_net · GitHub.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews