Trying to change IP config on Zebra printer with SGD code - zebra-printers

I am trying to configure the IP, subnet, and gateway addresses on a zebra ZT410 printer with SGD commands.
I am using the "Zebra setup utility", my getvar commands work, but setvar commands do not work. What Am I doing wrong ? My code is below...
! U setvar "internal_wired.ip.addr" "100.100.100.101"
setvar "internal_wired.ip.netmask" "255.255.255.0"
setvar "internal_wired.ip.gateway" "100.100.100.254"
END

Related

What is this command prompt code in MacOS?

I know this code works on Windows, but how do I get workable code executable on MacOS?
netsh -c interface ipv4 add neighbors "(connection name)" "(router
address)" "(mac address)" store=persistent
Any suggestions please...
try typing "man arp" into the terminal. Something like this might work :
arp -s hostname ether_addr
Create an ARP entry for the host called hostname with the Ethernet address ether_addr. The Ethernet address is
given as six hex bytes separated by colons. The entry will be permanent unless the word temp is given in the
command. If the word pub is given, the entry will be ``published''; i.e., this system will act as an ARP server,
responding to requests for hostname even though the host address is not its own. In this case the ether_addr can
be given as auto in which case the interfaces on this host will be examined, and if one of them is found to
occupy the same subnet, its Ethernet address will be used. If the only keyword is also specified, this will cre-
ate a ``published (proxy only)'' entry. This type of entry is created automatically if arp detects that a rout-
ing table entry for hostname already exists.

windows get IP dynamically

i want to implement the following logic. Does it possible to have such implementation using batch or power shell ? please share with me script for that.
Let say I have a configuration file with the following "config.propertis":
BOOTPRORO=statis or dhcp
IPADDR=192.168.10.10
NETMASK=255.255.255.0
GATEWAY=192.168.10.1
DNS=8.8.8.8
I want that at startup the system will check that file and configure network accordingly:
OS: Windows
if in BOOTPROTO=dhcp, when use DHCP in network configuration and ignore all another in config file, except DNS
if in BOOTPROTO=static, then use all variables from config file to configure IP as static.
So, I have such logic under the Linus, using shell. The script in configured in rc.d and execute before network service. Does it possible to implement such over the Windows ? Guys, please share the script !
We can definitely do this.
First things first, because a lot of systems have more than one network interface, you'll need to determine what the ifIndex is of the adapter that we want to change. Do that by running Get-NetIPInterface. You should see results like this:
In my example and going forward, I'll be using this index, 41. You should change this to match what you find on your own computer.
OK, now to read from the text file. Since you've provided the data in a key=value pair format, commonly called a hashtable, we can easily grab the data from there using ConvertFrom-Stringdata. This will give us a PowerShell hashtable, and we can pull the needed line out like this.
$values = get-content T:\config.properties | ConvertFrom-StringData
$values.BootProro
>statis
We can us this to set the PC in Dynamic IP mode, or to set static addresses. Now, for you to use this in your environment, you need to find the ifIndex, as I mentioned before. replace my index of 41 with your own, and then give it a shot. I've added -WhatIf to every line, so you will see what would happen when you run it. If you're happy with the changes it woudl make, remove -Whatif to make the script actually change the settings.
$values = gc T:\config.properties | ConvertFrom-StringData
if ($values.BOOTPRORO -eq "dhcp"){
Write-Output "---DHCP mode detected in 'config.properties' file"
Write-Output "---Setting Set-NetAdapter -DHCP Enabled"
Set-NetIPInterface –InterfaceIndex 41 –Dhcp Enabled -WhatIf
}
else{
Write-outPut "---static mode detected in 'config.properties' file"
Write-Output "---Removing network configuration"
Remove-NetIPAddress -InterfaceIndex 41 -whatif
Write-Output "---Setting new network configuration equal to"
$values
New-NetIPAddress -DefaultGateway $values.GATEWAY -IPAddress $values.IPADDR -PrefixLength 24 -InterfaceIndex 41 -WhatIf
Set-DnsClientServerAddress -ServerAddresses $values.DNS -InterfaceIndex 41 -WhatIf
}
The output looks like this:
in Windows we can set ip address via batch file or powershell script but when you use dhcp address your ip is Dynamic not static I Imposition you want static ip address
BAtch-file
netsh interface ip set address name=”Local Area Connection” static 192.168.10.10 255.255.255.0 192.168.10.1
netsh interface ip set dns name=”Local Area Connection” static 8.8.8.8
if you want be dhcp You should set
netsh interface ip set address name=”Local Area Connection” source=dhcp
note I Imposition you nic name is Local Area Connection
In powershell V3.0 and Later we Used
New-NetIPAddress –InterfaceAlias “Local Area Connection ” –IPv4Address “192.168.10.10” –PrefixLength 24 -DefaultGateway 192.168.10.1
Set-DnsClientServerAddress -InterfaceAlias “Local Area Connection” -ServerAddresses 8.8.8.8
and for startup you can put script .bat and .ps1 in startup windows but attention you should Set-ExecutionPolicy bypass before U run any script of powershell
for startup any script see link

How to access a ipv6 address using windows command?

I know how to access a ipv4 address using windows command.
Open command line and type
explorer.exe http://173.194.72.103
Here is the question, how to access a ipv6 address?
I tried to do this like ipv4
ping -6 www.google.com
result:Ping www.google.com [2607:f8b0:4006:808::1012]
explorer.exe http://2607:f8b0:4006:808::1012
or
explorer.exe https://2607:f8b0:4006:808::1012
Neither ok, they open "My Computer" panel.
If I put http://2607:f8b0:4006:808::1012 into the address bar of Google Chrome on Windows 7, it doesn't work (it searches for the "phrase" on Google). Likewise for IE. So I got to thinking, maybe your syntax is wrong, and it's not Explorer's fault. And I found this:
https://productforums.google.com/forum/#!topic/chrome/n3jUQROi1cA
Which says you must use brackets. And behold, this works:
explorer.exe http://[2607:f8b0:4006:808::1012]
The grammar is described in painstaking detail here: https://www.rfc-editor.org/rfc/rfc3986#section-3.2.2
The key parts are:
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"

Zebra ZT230-300dpi printer sgd command setvar

I'm trying to change the "device.languages" attribute on a zebra ZT230 label printer with firmware: V72.19.6Z using the Zebra Setup Utilities Direct communication function.
The command the i send to the printer is the following:
! U1 setvar "device.languages" "epl_zpl"
followed by a newline character
but when I send the command: ! U1 getvar "device.languages" the value has not been changed.
I'm connecting to the printer through LAN on port 9100 and the attribute "device.command_override.list" on the printer is not set.
I'm launching the command in the wrong manner or there is some protection mechanism that I'm not aware of?
Have you tried:
! UTILITIES
! U1 setvar "device.languages" "epl_zpl"
PRINT
or
! U1 setvar "device.languages" "epl_zpl"
PRINT
We contacted Zebra Support and they stated that the model ZT230 with the 300 DPI head didn't support the epl_zpl language.
the last model of the series with the support of the epl_zpl language is the one with the 203 DPI head.
with the printer ZT230 203DPI the command:
! U1 setvar "device.languages" "epl_zpl"
worked fine.

how to know 2 lan pc is connetced with my program in php?

I have 4 PCs which are connected through the LAN. I am making a PHP program that will
differentiate each PC separately and i will keep each pc record.
But when i am getting an IP address i am getting same IP for all. I guess i should retrieve MAC address for all pcs separately, but i don't know how will i fetch MAC address.
I am using Linux OS.
Programing tips will be appreciated.
As far as I know, you cannot do this with PHP alone. However, if you have exec() rights on the server, the you might be able to use:
arp -a ipaddress
Where ipaddress is the IP address of the computer on your LAN. You would need to use something like regex to seperate the MAC address from the rest of the output.
I don't think that the mac-adress is included in the http-header. So it is probably hard to get it via php. I think you're better off trying to fix the ip-issue. Sorry I can't help you more.
Edit:
Actually... searching around a little I found a possible solution:
$mac = `ping -c 1 $ip && arp -a | grep $ip`
You probably have to parse the output though. I get:
xxx.xxx.local (192.168.0.10) at d5:c2:c3:13:a2:b1 [ether] on eth0
When doing arp -a 192.168.0.10
Edit:
Like the post under states, you would need exec-rights.
Edit:
Sorry, just realized that in order for this to work, you would need the ip... Which you don't have.
PEAR’s Net_Ping is a niffty wrapper class for executing ping calls from PHP. You can use it to check if a remote server is responding correctly. The library can be download from here.
pear install Net_Ping-2.4.4
<?php
require_once "Net/Ping.php";
$ping = Net_Ping::factory();
if(PEAR::isError($ping))
echo $ping->getMessage();
else
{
/* Number of packets to send */
$ping->setArgs(array('count' => 4));
$rawData = $ping->ping('google.com');
print_r($rawData);
}
?>

Resources