DHCP Server Port-Based Address Allocation switch cisco 2960 - cisco

In my work they asked me to configure a switch cisco 2960 and to the switch we will connect printers, they want that the switch gives the ip to the printers with DHCP (we dont have a dhcp server) and they also want that in each individual port an ip would be assigned, doesnt matter if they change the printer they want the same ip address assign this is in case a printer fails and they want only to replace it and dont have to do anything about configurations. I have configured DHCP Server Port-Based Address Allocation but it isnt working
I used this guide http://www.cisco.com/en/US/docs/ios-xml/ios/ipaddr_dhcp/configuration/xe-3se/5700/dhcp-prt-bsd-aa.pdf
but it isnt assigning anything.

Tough to give a good answer without seeing your config. I'm going to assume you've checked you're running a version of code that supports this and that you've checked for typos.
Given that, I can only see one thing. In the doc you've linked to, it shows the syntax for the assignment being:
ip dhcp pool dhcppool
network 10.1.1.0 255.255.255.0
address 10.1.1.7 client-id Et1/0 ascii
In this document which is specifically for the 2960, it shows quotes round the Et1/0. So you have:
ip dhcp pool dhcppool
network 10.1.1.0 255.255.255.0
address 10.1.1.7 client-id "Et1/0" ascii
Beyond that, is it bulking at a certain point or is it taking all the commands?
I don't have a 2960 here to test it, so this is the best I can do.
Hope this helps.

Related

How to write a Node.js server if my pc's ip address changes daily

I am owning a Windows PC. I have written a Web application that runs fine. But the problem is my PC's IP changes periodically. I want that application to be accessible in the network (from other pc's) without changing client side code . My client side code is in angular js.
The web server of your web application cannot bind to the correct IP if it doesn't know it in advance.
You can make your IP address static by following these steps:
In Windows, go to the Network and Sharing center
In the left pane, choose "Change adapter settings"
Right click your ethernet or wifi connection (the one connected to your router) and choose Properties
Double click Internet Protocol Version 4 (TCP / IPv4)
As an IP address, choose the one your computer already has (or try another IP address starting with the first same 3 numbers, i.e. xxx.xxx.xxx.yyy)
The default gateway is the IP address of your router
The subnet mask is typically 255.255.255.0
For the DNS server choose Google's 8.8.8.8 and/or your router's IP address
You have several choices depending upon your configuration.
If this is the public dynamic IP you get from your ISP, you can go to your ISP (whoever you get internet service from) and upgrade your service to a static IP address so it won't change.
If this is the public dynamic IP you get from your ISP, you can use a dynamic DNS service to attach a hostname to your IP address and then use that hostname to access the server. The dynamic DDNS app you put on your server will keep the DNS updated whenever your dynamic IP address changes.
If this is just a local IP address on your LAN (a 192.x.x.x or 10.x.x.x address), then you can pick an IP address that your router supports, but is above the range being used for DHCP and set that computer to use that IP address and not DHCP. In Windows, you can go to the networking configuration and choose the IP address instead of using DHCP. Then, the IP address won't ever change. It is important that you pick an address outside the range used for DHCP to avoid any conflicts. On my own LAN where the router is allocating addresses like 192.168.0.x, I manually assign addresses like 192.168.1.250.
This is something that your router handles through a protocol known as DHCP. Basically, the answer is to keep your IP from changing.
Many routers allow you to reserve an IP for certain MAC addresses. I would recommend that you access your router over your local network and work with the GUI it provides to try to configure this... if you're successful, then your IP will no longer change, and problem solved :-) If it's not intuitive, then of course refer to the documentation for your router.

Changing IP address at runtime

I am creating a tcp connection using the function socket(), bind(), and then listen().
Our customers would like to be able to define an IP address of the server at runtime. Is there a way of changing the IP at runtime or must it be done in the BIOS?
Thanks for any tips
I've changed the IP address using ifAddrSet(..) many times. Usually I call this function from within the startup script before my application is running so I have no idea how calling this function affects already connected sockets.
But have a look at the functions provided by ifLib.h. I'm sure you'll find something that suits your needs (ifAddrAdd(..) looks promising).
I am not sure what you mean by defining 'IP address of the server at runtime?'. Obviously for a given socket it's IP address cannot be changed. It's an endpoint of a connection, it cannot be changed run time. If you just want to assign multiple IP addresses to a host that's possible.
In general - you can add as many IP addresses as you want to your machine (ok not exactly) but certainly a hundred or so (ie. statically allocated). That's not the problem (management of that is a nightmare, but sure not impossible). The problem is how those IP addresses are reached, that is not in your control, that depends upon the settings on client especially the routing entries. eg. you could use all of the IP addresses in a Subnet (say 10.1.2/24).
Not recommended - but possible.
Once you have those IP addresses - you bind on the port and address as INADDR_ANY, which says accept connection on 'any ' of the local addresses. On which address the connection was made to can be determined on server using getsockname.

Avahi DNS-SD on multiple IP addresses

Background:
I'm trying to communicate with an IP camera without the need of a DHCP server. This is how the camera acquires an IP address:
Basic DHCP procedure (discover etc.)
If above should fail the camera has a fallback address of 192.168.0.90
The camera then starts the avahi-daemon and successfully gets a link-local address too for robustness
The IP aliasing is now done and the interface has two IPs.
Problem:
Now the problem is that when I avahi-browse to browse the services on the network, the camera replies with both IP addresses (checked with Wireshark).
Only one is shown by avahi and it could be the zeroconf:ed address or the fallback address.
I want the link local address only, not the fallback. Any reliable way to get it?
Old question but just in case someone else has the same problem:
Avahi will only return one of the IP addresses reported by the device. This seems to be a (debatable) design decision and is explained in this post of the avahi mailing list. So I'm afraid there's no reliable way to get only the link-local address, if you are using avahi-browse.
On a side note, RFC3927 section 1.9 specifically recommends NOT to configure both a routable address and a link-local address simultaneously for the same interface. But I do understand this is the camera's behaviour and probably outside your control.

give local node server a name rather then ip address

This might be a stupid question, but i run a business in a strip mall and internet is included (because of this I have no access to the router). the router assigns dynamic ip address and when I set a static ip I lose connection.
is there a way to change the address to my node app from "http:/ /[my-server-ip]:3000" to something like "http:/ /[business-name]:3000". (/ / should be // but stack wont let me post with dead links)
the main reason for this is I have multiple tablets and devices that use this system however recently after they made some changes to the routers setting my computer will be assigned two or three ip addresses a day (I notified the landlord he says its normal). and everytime my ip address changes I lose connection to my app.
is there a possible fix that doesnt require me to host on a web server or enable port forwarding?
perhaps I should reword the question. How do I go about setting up local dns zones from mac? (I know this can be achieved with most linux distros)
No you can't.
Your server IP will always change as the router gives you a new IP address, so change the hosts will not work unless every time the ip on the server changes, you change your ip as well on the devices.
You may try to create an account on dns sites like http://www.noip.com/. They will give you an "external" internet address like mybusiness.noip.com and then you will point your programs on tablets and cell phones to this address.
You will then install a program on your server that will tell noip what the new address is maintaining the same mybusiness.noip.com on them.

Possible to have PPPoE and separate static IP address on same NIC?

Greetings,
For various reasons, my connection to the internet looks like this:
[DSL Modem in Bridge Mode] <-ethernet-> (eth0)[Linux system](eth1) <-ethernet-> [Wireless Router]
(Where the Linux system is running PPPoE, BIND, DHCP, etc.)
In order to diagnose a recent problem, I needed to connect to the web interface on the DSL modem. In order to do this I have to connect from a specific address range and as I am running PPPoE on eth0, I haven't assigned an address to it nor even turn it on. (The modem's web interface is at a fixed IP address regardless of what mode the modem is in and only answers to traffic from a fixed address range)
So anyway, to connect to the modem, and not finding anything helpful on the internet, I just tried assigning an IP address to eth0 after already starting PPPoE (like this: ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up). I didn't really think that it would actually work. But it did. I.e. PPPoE and a static address assigned to eth0 at the same time and both worked correctly. Thus my question.. Should it? Is it safe to do this long-term or am I just lucky that it works long enough for me to get that which I need to done?
Thanks!
It's fine. PPPoE and IP are carried in Ethernet frames of different types.

Resources